You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Complex numbers are an extension of the familiar real number system in which all numbers are expressed as a sum of a real part and an imaginary part. Imaginary numbers are real multiples of the imaginary unit (the square root of -1), often written i in mathematics or j in engineering. Python has built-in support for complex numbers, which are written with this latter notation; the imaginary part is written with a j suffix, e.g., 3+1j. To get access to complex equivalents of the math module, use cmath. Use of complex numbers is a fairly advanced mathematical feature. If you’re not aware of a need for them, it’s almost certain you can safely ignore them.
6
6
7
7
Complex numbers are stored as a pair of machine-level double precision floating point numbers.
8
8
9
9
Constructors
10
-
------------
10
+
====
11
11
`complex()`_
12
12
Returns an expression converted into a complex number.
Copy file name to clipboardExpand all lines: source/docs/float/index.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,24 @@
1
-
=====
1
+
====
2
2
float
3
-
=====
3
+
====
4
4
5
5
These represent machine-level double precision floating point numbers. You are at the mercy of the underlying machine architecture (and C or Java implementation) for the accepted range and handling of overflow. Python does not support single-precision floating point numbers; the savings in processor and memory usage that are usually the reason for using these is dwarfed by the overhead of using objects in Python, so there is no reason to complicate the language with two kinds of floating point numbers.
6
6
7
7
Floating point numbers are usually implemented using double in C; information about the precision and internal representation of floating point numbers for the machine on which your program is running is available in sys.float_info.
8
8
9
9
Constructors
10
-
------------
10
+
====
11
11
`float()`_
12
12
Returns an expression converted into a floating point number.
13
13
`Literal Syntax`_
14
14
15
15
Scientific Notation
16
-
-----------------
16
+
====
17
17
`e | E (scientific notation)`_
18
18
Returns a float multiplied by the specified power of 10.
19
19
20
20
Methods
21
-
-------
21
+
====
22
22
`as_integer_ratio`_
23
23
Returns a pair of integers whose ratio is exactly equal to the original float and with a positive denominator.
Copy file name to clipboardExpand all lines: source/docs/ints/index.rst
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,26 @@
1
-
===
1
+
====
2
2
int
3
-
===
3
+
====
4
+
4
5
These represent numbers in the range -2147483648 through 2147483647. (The range may be larger on machines with a larger natural word size, but not smaller.) When the result of an operation would fall outside this range, the result is normally returned as a long integer (in some cases, the exception OverflowError is raised instead). For the purpose of shift and mask operations, integers are assumed to have a binary, 2’s complement notation using 32 or more bits, and hiding no bits from the user (i.e., all 4294967296 different bit patterns correspond to different values).
5
6
6
7
Plain integers (also just called integers) are implemented using long in C, which gives them at least 32 bits of precision (sys.maxint is always set to the maximum plain integer value for the current platform; the minimum value is -sys.maxint - 1). Long integers have unlimited precision.
7
8
8
9
Numbers are created by numeric literals or as the result of built-in functions and operators. Unadorned integer literals (including binary, hex, and octal numbers) yield plain integers unless the value they denote is too large to be represented as a plain integer, in which case they yield a long integer. Integer literals with an 'L' or 'l' suffix yield long integers ('L' is preferred because 1l looks too much like eleven!).
9
10
10
11
Constructors
11
-
------------
12
+
====
12
13
`int()`_
13
14
Returns an expression converted into an integer number.
14
15
`int Literal Syntax`_
15
16
16
17
Base Designators
17
-
----------------
18
+
====
18
19
`0... (Base Designators)`_
19
20
Returns a decimal integer converted from the specified base.
20
21
21
22
Methods
22
-
-------
23
+
====
23
24
`bit_length`_
24
25
Returns the number of bits necessary to represent an integer in binary, excluding the sign and leading zeros.
Copy file name to clipboardExpand all lines: source/docs/ints/indexl.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,18 @@ long
4
4
These represent numbers in an unlimited range, subject to available (virtual) memory only. For the purpose of shift and mask operations, a binary representation is assumed, and negative numbers are represented in a variant of 2’s complement which gives the illusion of an infinite string of sign bits extending to the left.
5
5
6
6
Constructors
7
-
------------
7
+
====
8
8
`long()`_
9
9
Returns an expression converted into a long integer number.
10
10
`long Literal Syntax`_
11
11
12
12
Base Designators
13
-
----------------
13
+
====
14
14
`0... (Base Designators)`_
15
15
Returns a decimal integer converted from the specified base.
16
16
17
17
Methods
18
-
-------
18
+
====
19
19
`bit_length`_
20
20
Returns the number of bits necessary to represent an integer in binary, excluding the sign and leading zeros.
Copy file name to clipboardExpand all lines: source/docs/list/index.rst
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,27 @@
1
1
====
2
2
list
3
3
====
4
-
5
-
Lists are mutable ordered and indexed collections of objects. Often called arrays in other languages. The items of a list are arbitrary Python objects. Lists are formed by placing a comma-separated list of expressions in square brackets. (Note that there are no special cases needed to form lists of length 0 or 1.)
4
+
Lists are mutable ordered and indexed collections of objects. The items of a list are arbitrary Python objects. Lists are formed by placing a comma-separated list of expressions in square brackets. (Note that there are no special cases needed to form lists of length 0 or 1.)
6
5
7
6
Constructors
8
-
============
7
+
====
9
8
`list()`_
10
9
Converts an object into a list.
11
10
`[] list comprehensions`_
12
11
Returns a list based on existing iterables.
13
12
`literal syntax`_
14
-
15
-
Misc
13
+
Initializes a new instance of the **list** type.
14
+
15
+
Operators
16
16
====
17
17
`[] (index operator)`_
18
18
Gives access to a sequence's element.
19
19
`[::] (slicing)`_
20
20
Gives access to a specified range of sequence's elements.
21
+
`+ (concatenation)`_
22
+
Returns a concatenation of two sequences.
23
+
`* (multiple concatenation)`_
24
+
Returns a sequence self-concatenated specified amount of times.
21
25
22
26
Functions
23
27
====
@@ -27,6 +31,8 @@ Functions
27
31
Returns the smallest item from a collection.
28
32
`max`_
29
33
Returns the largest item in an iterable or the largest of two or more arguments.
34
+
`cmp`_
35
+
Compares two objects and returns an integer according to the outcome.
30
36
`sum`_
31
37
Returns a total of the items contained in the iterable object.
32
38
`sorted`_
@@ -43,10 +49,10 @@ Functions
43
49
Returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables.
44
50
45
51
Methods
46
-
=======
52
+
====
47
53
48
54
Adding Elements
49
-
_______________
55
+
----
50
56
`insert`_
51
57
Inserts an item at a given position.
52
58
`append`_
@@ -55,14 +61,14 @@ _______________
55
61
Extends the list by appending all the items from the iterable.
56
62
57
63
Deleting
58
-
________
64
+
----
59
65
`remove`_
60
66
Removes the first item from the list which matches the specified value.
61
67
`pop`_
62
68
Removes and returns the item at the specified index.
63
69
64
70
Information
65
-
___________
71
+
----
66
72
`index`_
67
73
Returns the index of the first occurrence of the specified list item.
Copy file name to clipboardExpand all lines: source/docs/sets/index.rst
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Sets do not record element position or order of insertion. Accordingly, sets do
9
9
Sets are implemented using dictionaries. They cannot contain mutable elements such as lists or dictionaries. However, they can contain immutable collections.
10
10
11
11
Constructors
12
-
------------
12
+
====
13
13
`set()`_
14
14
Returns a set type initialized from iterable.
15
15
`{} set comprehension`_
@@ -40,17 +40,17 @@ Functions
40
40
Returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables.
41
41
42
42
Methods
43
-
-------
43
+
====
44
44
45
45
Adding Elements
46
-
_______________
46
+
----
47
47
`add`_
48
48
Adds a specified element to the set.
49
49
`update`_
50
50
Adds specified elements to the set.
51
51
52
52
Deleting
53
-
________
53
+
----
54
54
`discard`_
55
55
Removes an element from the set.
56
56
`remove`_
@@ -61,7 +61,7 @@ ________
61
61
Removes all elements from the set.
62
62
63
63
Information
64
-
___________
64
+
----
65
65
`issuperset`_
66
66
Returns a Boolean stating whether the set contains the specified set or iterable.
67
67
`issubset`_
@@ -70,7 +70,7 @@ ___________
70
70
Returns a Boolean stating whether the set contents do not overlap with the specified set or iterable.
71
71
72
72
Set Operations
73
-
______________
73
+
----
74
74
`difference`_
75
75
Returns a new set with elements in the set that are not in the specified iterables.
76
76
`intersection`_
@@ -81,7 +81,7 @@ ______________
81
81
Returns a new set with elements from the set and the specified iterables.
82
82
83
83
Set Operations Assignment
84
-
_____________________________
84
+
----
85
85
`difference_update`_
86
86
Updates the set, removing elements found in the specified iterables.
87
87
`intersection_update`_
@@ -90,20 +90,20 @@ _____________________________
90
90
Updates the set, keeping only elements found in either set or the specified iterable, but not in both.
91
91
92
92
Copying
93
-
_______
93
+
----
94
94
`copy`_
95
95
Returns a copy of the set.
96
96
97
97
Set Operators
98
-
-------------
98
+
====
99
99
100
100
Adding Elements
101
-
_______________
101
+
----
102
102
`|= (update)`_
103
103
Adds elements from another set.
104
104
105
105
Relational Operators
106
-
____________________
106
+
----
107
107
`== (is equal)`_
108
108
Returns a Boolean stating whether the set has the same elements as the other set.
109
109
`!= (is not equal)`_
@@ -118,7 +118,7 @@ ____________________
118
118
Returns a Boolean stating whether the set contains the other set and that the sets are not equal.
119
119
120
120
Set Operations
121
-
______________
121
+
----
122
122
`- (difference)`_
123
123
Returns a new set with elements in the set that are not in the other set.
124
124
`& (intersection)`_
@@ -129,7 +129,7 @@ ______________
129
129
Returns a new set with elements from the set and the other set.
130
130
131
131
Set Operations Assignment
132
-
_________________________
132
+
----
133
133
`-= (difference_update)`_
134
134
Updates the set, removing elements found in the other set.
0 commit comments