@@ -116,7 +116,7 @@ are always available. They are listed here in alphabetical order.
116
116
117
117
As :func: `repr `, return a string containing a printable representation of an
118
118
object, but escape the non-ASCII characters in the string returned by
119
- :func: `repr ` using ``\x ``, ``\u `` or ``\U `` escapes. This generates a string
119
+ :func: `repr ` using ``\x ``, ``\u ``, or ``\U `` escapes. This generates a string
120
120
similar to that returned by :func: `repr ` in Python 2.
121
121
122
122
@@ -132,7 +132,7 @@ are always available. They are listed here in alphabetical order.
132
132
>>> bin (- 10 )
133
133
'-0b1010'
134
134
135
- If prefix "0b" is desired or not, you can use either of the following ways.
135
+ If the prefix "0b" is desired or not, you can use either of the following ways.
136
136
137
137
>>> format (14 , ' #b' ), format (14 , ' b' )
138
138
('0b1110', '1110')
@@ -146,7 +146,7 @@ are always available. They are listed here in alphabetical order.
146
146
147
147
Return a Boolean value, i.e. one of ``True `` or ``False ``. *x * is converted
148
148
using the standard :ref: `truth testing procedure <truth >`. If *x * is false
149
- or omitted, this returns ``False ``; otherwise it returns ``True ``. The
149
+ or omitted, this returns ``False ``; otherwise, it returns ``True ``. The
150
150
:class: `bool ` class is a subclass of :class: `int ` (see :ref: `typesnumeric `).
151
151
It cannot be subclassed further. Its only instances are ``False `` and
152
152
``True `` (see :ref: `bltin-boolean-values `).
@@ -206,7 +206,7 @@ are always available. They are listed here in alphabetical order.
206
206
.. class :: bytes([source[, encoding[, errors]]])
207
207
:noindex:
208
208
209
- Return a new "bytes" object, which is an immutable sequence of integers in
209
+ Return a new "bytes" object which is an immutable sequence of integers in
210
210
the range ``0 <= x < 256 ``. :class: `bytes ` is an immutable version of
211
211
:class: `bytearray ` -- it has the same non-mutating methods and the same
212
212
indexing and slicing behavior.
@@ -245,7 +245,7 @@ are always available. They are listed here in alphabetical order.
245
245
246
246
Transform a method into a class method.
247
247
248
- A class method receives the class as implicit first argument, just like an
248
+ A class method receives the class as an implicit first argument, just like an
249
249
instance method receives the instance. To declare a class method, use this
250
250
idiom::
251
251
@@ -342,7 +342,7 @@ are always available. They are listed here in alphabetical order.
342
342
object due to stack depth limitations in Python's AST compiler.
343
343
344
344
.. versionchanged :: 3.2
345
- Allowed use of Windows and Mac newlines. Also input in ``'exec' `` mode
345
+ Allowed use of Windows and Mac newlines. Also, input in ``'exec' `` mode
346
346
does not have to end in a newline anymore. Added the *optimize * parameter.
347
347
348
348
.. versionchanged :: 3.5
@@ -420,7 +420,7 @@ are always available. They are listed here in alphabetical order.
420
420
421
421
If the object does not provide :meth: `__dir__ `, the function tries its best to
422
422
gather information from the object's :attr: `~object.__dict__ ` attribute, if defined, and
423
- from its type object. The resulting list is not necessarily complete, and may
423
+ from its type object. The resulting list is not necessarily complete and may
424
424
be inaccurate when the object has a custom :func: `__getattr__ `.
425
425
426
426
The default :func: `dir ` mechanism behaves differently with different types of
@@ -466,7 +466,7 @@ are always available. They are listed here in alphabetical order.
466
466
467
467
.. function :: divmod(a, b)
468
468
469
- Take two (non complex) numbers as arguments and return a pair of numbers
469
+ Take two (non- complex) numbers as arguments and return a pair of numbers
470
470
consisting of their quotient and remainder when using integer division. With
471
471
mixed operand types, the rules for binary arithmetic operators apply. For
472
472
integers, the result is the same as ``(a // b, a % b) ``. For floating point
@@ -528,13 +528,13 @@ are always available. They are listed here in alphabetical order.
528
528
2
529
529
530
530
This function can also be used to execute arbitrary code objects (such as
531
- those created by :func: `compile `). In this case pass a code object instead
531
+ those created by :func: `compile `). In this case, pass a code object instead
532
532
of a string. If the code object has been compiled with ``'exec' `` as the
533
533
*mode * argument, :func: `eval `\' s return value will be ``None ``.
534
534
535
535
Hints: dynamic execution of statements is supported by the :func: `exec `
536
536
function. The :func: `globals ` and :func: `locals ` functions
537
- returns the current global and local dictionary, respectively, which may be
537
+ return the current global and local dictionary, respectively, which may be
538
538
useful to pass around for use by :func: `eval ` or :func: `exec `.
539
539
540
540
If the given source is a string, then leading and trailing spaces and tabs
@@ -569,7 +569,7 @@ are always available. They are listed here in alphabetical order.
569
569
will be used for both the global and the local variables. If *globals * and
570
570
*locals * are given, they are used for the global and local variables,
571
571
respectively. If provided, *locals * can be any mapping object. Remember
572
- that at module level, globals and locals are the same dictionary. If exec
572
+ that at the module level, globals and locals are the same dictionary. If exec
573
573
gets two separate objects as *globals * and *locals *, the code will be
574
574
executed as if it were embedded in a class definition.
575
575
@@ -627,7 +627,7 @@ are always available. They are listed here in alphabetical order.
627
627
preceded by a sign, and optionally embedded in whitespace. The optional
628
628
sign may be ``'+' `` or ``'-' ``; a ``'+' `` sign has no effect on the value
629
629
produced. The argument may also be a string representing a NaN
630
- (not-a-number), or a positive or negative infinity. More precisely, the
630
+ (not-a-number), or positive or negative infinity. More precisely, the
631
631
input must conform to the following grammar after leading and trailing
632
632
whitespace characters are removed:
633
633
@@ -640,7 +640,7 @@ are always available. They are listed here in alphabetical order.
640
640
641
641
Here ``floatnumber `` is the form of a Python floating-point literal,
642
642
described in :ref: `floating `. Case is not significant, so, for example,
643
- "inf", "Inf", "INFINITY" and "iNfINity" are all acceptable spellings for
643
+ "inf", "Inf", "INFINITY", and "iNfINity" are all acceptable spellings for
644
644
positive infinity.
645
645
646
646
Otherwise, if the argument is an integer or a floating point number, a
@@ -687,7 +687,7 @@ are always available. They are listed here in alphabetical order.
687
687
688
688
Convert a *value * to a "formatted" representation, as controlled by
689
689
*format_spec *. The interpretation of *format_spec * will depend on the type
690
- of the *value * argument, however there is a standard formatting syntax that
690
+ of the *value * argument; however, there is a standard formatting syntax that
691
691
is used by most built-in types: :ref: `formatspec `.
692
692
693
693
The default *format_spec * is an empty string which usually gives the same
@@ -771,7 +771,7 @@ are always available. They are listed here in alphabetical order.
771
771
topic, and a help page is printed on the console. If the argument is any other
772
772
kind of object, a help page on the object is generated.
773
773
774
- Note that if a slash(/) appears in the parameter list of a function, when
774
+ Note that if a slash(/) appears in the parameter list of a function when
775
775
invoking :func: `help `, it means that the parameters prior to the slash are
776
776
positional-only. For more info, see
777
777
:ref: `the FAQ entry on positional-only parameters <faq-positional-only-arguments >`.
@@ -898,7 +898,7 @@ are always available. They are listed here in alphabetical order.
898
898
.. function :: isinstance(object, classinfo)
899
899
900
900
Return ``True `` if the *object * argument is an instance of the *classinfo *
901
- argument, or of a (direct, indirect or :term: `virtual <abstract base
901
+ argument, or of a (direct, indirect, or :term: `virtual <abstract base
902
902
class> `) subclass thereof. If *object * is not
903
903
an object of the given type, the function always returns ``False ``.
904
904
If *classinfo * is a tuple of type objects (or recursively, other such
@@ -913,7 +913,7 @@ are always available. They are listed here in alphabetical order.
913
913
914
914
.. function :: issubclass(class, classinfo)
915
915
916
- Return ``True `` if *class * is a subclass (direct, indirect or :term: `virtual
916
+ Return ``True `` if *class * is a subclass (direct, indirect, or :term: `virtual
917
917
<abstract base class> `) of *classinfo *. A
918
918
class is considered a subclass of itself. *classinfo * may be a tuple of class
919
919
objects or a :ref: `types-union `, in which case every entry in *classinfo *
@@ -1068,7 +1068,7 @@ are always available. They are listed here in alphabetical order.
1068
1068
.. class :: object()
1069
1069
1070
1070
Return a new featureless object. :class: `object ` is a base for all classes.
1071
- It has the methods that are common to all instances of Python classes. This
1071
+ It has methods that are common to all instances of Python classes. This
1072
1072
function does not accept any arguments.
1073
1073
1074
1074
.. note ::
@@ -1089,7 +1089,7 @@ are always available. They are listed here in alphabetical order.
1089
1089
>>> oct (- 56 )
1090
1090
'-0o70'
1091
1091
1092
- If you want to convert an integer number to octal string either with prefix
1092
+ If you want to convert an integer number to an octal string either with the prefix
1093
1093
"0o" or not, you can use either of the following ways.
1094
1094
1095
1095
>>> ' %#o ' % 10 , ' %o ' % 10
@@ -1113,16 +1113,16 @@ are always available. They are listed here in alphabetical order.
1113
1113
*file * is a :term: `path-like object ` giving the pathname (absolute or
1114
1114
relative to the current working directory) of the file to be opened or an
1115
1115
integer file descriptor of the file to be wrapped. (If a file descriptor is
1116
- given, it is closed when the returned I/O object is closed, unless *closefd *
1116
+ given, it is closed when the returned I/O object is closed unless *closefd *
1117
1117
is set to ``False ``.)
1118
1118
1119
1119
*mode * is an optional string that specifies the mode in which the file is
1120
1120
opened. It defaults to ``'r' `` which means open for reading in text mode.
1121
1121
Other common values are ``'w' `` for writing (truncating the file if it
1122
- already exists), ``'x' `` for exclusive creation and ``'a' `` for appending
1122
+ already exists), ``'x' `` for exclusive creation, and ``'a' `` for appending
1123
1123
(which on *some * Unix systems, means that *all * writes append to the end of
1124
1124
the file regardless of the current seek position). In text mode, if
1125
- *encoding * is not specified the encoding used is platform dependent:
1125
+ *encoding * is not specified the encoding used is platform- dependent:
1126
1126
``locale.getpreferredencoding(False) `` is called to get the current locale
1127
1127
encoding. (For reading and writing raw bytes use binary mode and leave
1128
1128
*encoding * unspecified.) The available modes are:
@@ -1138,13 +1138,13 @@ are always available. They are listed here in alphabetical order.
1138
1138
``'r' `` open for reading (default)
1139
1139
``'w' `` open for writing, truncating the file first
1140
1140
``'x' `` open for exclusive creation, failing if the file already exists
1141
- ``'a' `` open for writing, appending to the end of the file if it exists
1141
+ ``'a' `` open for writing, appending to the end of file if it exists
1142
1142
``'b' `` binary mode
1143
1143
``'t' `` text mode (default)
1144
1144
``'+' `` open for updating (reading and writing)
1145
1145
========= ===============================================================
1146
1146
1147
- The default mode is ``'r' `` (open for reading text, synonym of ``'rt' ``).
1147
+ The default mode is ``'r' `` (open for reading text, a synonym of ``'rt' ``).
1148
1148
Modes ``'w+' `` and ``'w+b' `` open and truncate the file. Modes ``'r+' ``
1149
1149
and ``'r+b' `` open the file with no truncation.
1150
1150
@@ -1158,7 +1158,7 @@ are always available. They are listed here in alphabetical order.
1158
1158
1159
1159
There is an additional mode character permitted, ``'U' ``, which no longer
1160
1160
has any effect, and is considered deprecated. It previously enabled
1161
- :term: `universal newlines ` in text mode, which became the default behaviour
1161
+ :term: `universal newlines ` in text mode, which became the default behavior
1162
1162
in Python 3.0. Refer to the documentation of the
1163
1163
:ref: `newline <open-newline-parameter >` parameter for further details.
1164
1164
@@ -1250,8 +1250,8 @@ are always available. They are listed here in alphabetical order.
1250
1250
1251
1251
If *closefd * is ``False `` and a file descriptor rather than a filename was
1252
1252
given, the underlying file descriptor will be kept open when the file is
1253
- closed. If a filename is given *closefd * must be ``True `` (the default)
1254
- otherwise an error will be raised.
1253
+ closed. If a filename is given *closefd * must be ``True `` (the default);
1254
+ otherwise, an error will be raised.
1255
1255
1256
1256
A custom opener can be used by passing a callable as *opener *. The underlying
1257
1257
file descriptor for the file object is then obtained by calling *opener * with
@@ -1295,7 +1295,7 @@ are always available. They are listed here in alphabetical order.
1295
1295
single: text mode
1296
1296
module: sys
1297
1297
1298
- See also the file handling modules, such as, :mod: `fileinput `, :mod: `io `
1298
+ See also the file handling modules, such as :mod: `fileinput `, :mod: `io `
1299
1299
(where :func: `open ` is declared), :mod: `os `, :mod: `os.path `, :mod: `tempfile `,
1300
1300
and :mod: `shutil `.
1301
1301
@@ -1385,7 +1385,7 @@ are always available. They are listed here in alphabetical order.
1385
1385
.. function :: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False)
1386
1386
1387
1387
Print *objects * to the text stream *file *, separated by *sep * and followed
1388
- by *end *. *sep *, *end *, *file * and *flush *, if present, must be given as keyword
1388
+ by *end *. *sep *, *end *, *file *, and *flush *, if present, must be given as keyword
1389
1389
arguments.
1390
1390
1391
1391
All non-keyword arguments are converted to strings like :func: `str ` does and
@@ -1399,7 +1399,7 @@ are always available. They are listed here in alphabetical order.
1399
1399
arguments are converted to text strings, :func: `print ` cannot be used with
1400
1400
binary mode file objects. For these, use ``file.write(...) `` instead.
1401
1401
1402
- Whether output is buffered is usually determined by *file *, but if the
1402
+ Whether the output is buffered is usually determined by *file *, but if the
1403
1403
*flush * keyword argument is true, the stream is forcibly flushed.
1404
1404
1405
1405
.. versionchanged :: 3.3
@@ -1432,7 +1432,7 @@ are always available. They are listed here in alphabetical order.
1432
1432
x = property(getx, setx, delx, "I'm the 'x' property.")
1433
1433
1434
1434
If *c * is an instance of *C *, ``c.x `` will invoke the getter,
1435
- ``c.x = value `` will invoke the setter and ``del c.x `` the deleter.
1435
+ ``c.x = value `` will invoke the setter, and ``del c.x `` the deleter.
1436
1436
1437
1437
If given, *doc * will be the docstring of the property attribute. Otherwise, the
1438
1438
property will copy *fget *'s docstring (if it exists). This makes it possible to
@@ -1497,7 +1497,7 @@ are always available. They are listed here in alphabetical order.
1497
1497
1498
1498
Return a string containing a printable representation of an object. For many
1499
1499
types, this function makes an attempt to return a string that would yield an
1500
- object with the same value when passed to :func: `eval `, otherwise the
1500
+ object with the same value when passed to :func: `eval `; otherwise, the
1501
1501
representation is a string enclosed in angle brackets that contains the name
1502
1502
of the type of the object together with additional information often
1503
1503
including the name and address of the object. A class can control what this
@@ -1525,7 +1525,7 @@ are always available. They are listed here in alphabetical order.
1525
1525
``2 ``). Any integer value is valid for *ndigits * (positive, zero, or
1526
1526
negative). The return value is an integer if *ndigits * is omitted or
1527
1527
``None ``.
1528
- Otherwise the return value has the same type as *number *.
1528
+ Otherwise, the return value has the same type as *number *.
1529
1529
1530
1530
For a general Python object ``number ``, ``round `` delegates to
1531
1531
``number.__round__ ``.
@@ -1555,7 +1555,7 @@ are always available. They are listed here in alphabetical order.
1555
1555
.. function :: setattr(object, name, value)
1556
1556
1557
1557
This is the counterpart of :func: `getattr `. The arguments are an object, a
1558
- string and an arbitrary value. The string may name an existing attribute or a
1558
+ string, and an arbitrary value. The string may name an existing attribute or a
1559
1559
new attribute. The function assigns the value to the attribute, provided the
1560
1560
object allows it. For example, ``setattr(x, 'foobar', 123) `` is equivalent to
1561
1561
``x.foobar = 123 ``.
@@ -1574,9 +1574,9 @@ are always available. They are listed here in alphabetical order.
1574
1574
Return a :term: `slice ` object representing the set of indices specified by
1575
1575
``range(start, stop, step) ``. The *start * and *step * arguments default to
1576
1576
``None ``. Slice objects have read-only data attributes :attr: `~slice.start `,
1577
- :attr: `~slice.stop ` and :attr: `~slice.step ` which merely return the argument
1577
+ :attr: `~slice.stop `, and :attr: `~slice.step ` which merely return the argument
1578
1578
values (or their default). They have no other explicit functionality;
1579
- however they are used by NumPy and other third party packages.
1579
+ however, they are used by NumPy and other third- party packages.
1580
1580
Slice objects are also generated when extended indexing syntax is used. For
1581
1581
example: ``a[start:stop:step] `` or ``a[start:stop, i] ``. See
1582
1582
:func: `itertools.islice ` for an alternate version that returns an iterator.
@@ -1623,7 +1623,7 @@ are always available. They are listed here in alphabetical order.
1623
1623
an instance (such as ``C().f() ``). Moreover, they can be called as regular
1624
1624
functions (such as ``f() ``).
1625
1625
1626
- Static methods in Python are similar to those found in Java or C++. Also see
1626
+ Static methods in Python are similar to those found in Java or C++. Also, see
1627
1627
:func: `classmethod ` for a variant that is useful for creating alternate class
1628
1628
constructors.
1629
1629
@@ -1923,7 +1923,7 @@ are always available. They are listed here in alphabetical order.
1923
1923
and *locals * to determine how to interpret the name in a package context.
1924
1924
The *fromlist * gives the names of objects or submodules that should be
1925
1925
imported from the module given by *name *. The standard implementation does
1926
- not use its *locals * argument at all, and uses its *globals * only to
1926
+ not use its *locals * argument at all and uses its *globals * only to
1927
1927
determine the package context of the :keyword: `import ` statement.
1928
1928
1929
1929
*level * specifies whether to use absolute or relative imports. ``0 `` (the
0 commit comments