Skip to content

Commit 2d04920

Browse files
Clean up comma usage in Doc/library/functions.rst (GH-27083) (#27243)
(cherry picked from commit 1e651c6) Co-authored-by: α∂мιηιχтяαтσя <[email protected]>
1 parent a272164 commit 2d04920

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

Doc/library/functions.rst

+38-38
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ are always available. They are listed here in alphabetical order.
116116

117117
As :func:`repr`, return a string containing a printable representation of an
118118
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
120120
similar to that returned by :func:`repr` in Python 2.
121121

122122

@@ -132,7 +132,7 @@ are always available. They are listed here in alphabetical order.
132132
>>> bin(-10)
133133
'-0b1010'
134134

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.
136136

137137
>>> format(14, '#b'), format(14, 'b')
138138
('0b1110', '1110')
@@ -146,7 +146,7 @@ are always available. They are listed here in alphabetical order.
146146

147147
Return a Boolean value, i.e. one of ``True`` or ``False``. *x* is converted
148148
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
150150
:class:`bool` class is a subclass of :class:`int` (see :ref:`typesnumeric`).
151151
It cannot be subclassed further. Its only instances are ``False`` and
152152
``True`` (see :ref:`bltin-boolean-values`).
@@ -206,7 +206,7 @@ are always available. They are listed here in alphabetical order.
206206
.. class:: bytes([source[, encoding[, errors]]])
207207
:noindex:
208208

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
210210
the range ``0 <= x < 256``. :class:`bytes` is an immutable version of
211211
:class:`bytearray` -- it has the same non-mutating methods and the same
212212
indexing and slicing behavior.
@@ -245,7 +245,7 @@ are always available. They are listed here in alphabetical order.
245245

246246
Transform a method into a class method.
247247

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
249249
instance method receives the instance. To declare a class method, use this
250250
idiom::
251251

@@ -342,7 +342,7 @@ are always available. They are listed here in alphabetical order.
342342
object due to stack depth limitations in Python's AST compiler.
343343

344344
.. 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
346346
does not have to end in a newline anymore. Added the *optimize* parameter.
347347

348348
.. versionchanged:: 3.5
@@ -420,7 +420,7 @@ are always available. They are listed here in alphabetical order.
420420

421421
If the object does not provide :meth:`__dir__`, the function tries its best to
422422
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
424424
be inaccurate when the object has a custom :func:`__getattr__`.
425425

426426
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.
466466

467467
.. function:: divmod(a, b)
468468

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
470470
consisting of their quotient and remainder when using integer division. With
471471
mixed operand types, the rules for binary arithmetic operators apply. For
472472
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.
528528
2
529529

530530
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
532532
of a string. If the code object has been compiled with ``'exec'`` as the
533533
*mode* argument, :func:`eval`\'s return value will be ``None``.
534534

535535
Hints: dynamic execution of statements is supported by the :func:`exec`
536536
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
538538
useful to pass around for use by :func:`eval` or :func:`exec`.
539539

540540
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.
569569
will be used for both the global and the local variables. If *globals* and
570570
*locals* are given, they are used for the global and local variables,
571571
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
573573
gets two separate objects as *globals* and *locals*, the code will be
574574
executed as if it were embedded in a class definition.
575575

@@ -627,7 +627,7 @@ are always available. They are listed here in alphabetical order.
627627
preceded by a sign, and optionally embedded in whitespace. The optional
628628
sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value
629629
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
631631
input must conform to the following grammar after leading and trailing
632632
whitespace characters are removed:
633633

@@ -640,7 +640,7 @@ are always available. They are listed here in alphabetical order.
640640

641641
Here ``floatnumber`` is the form of a Python floating-point literal,
642642
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
644644
positive infinity.
645645

646646
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.
687687

688688
Convert a *value* to a "formatted" representation, as controlled by
689689
*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
691691
is used by most built-in types: :ref:`formatspec`.
692692

693693
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.
771771
topic, and a help page is printed on the console. If the argument is any other
772772
kind of object, a help page on the object is generated.
773773

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
775775
invoking :func:`help`, it means that the parameters prior to the slash are
776776
positional-only. For more info, see
777777
: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.
898898
.. function:: isinstance(object, classinfo)
899899

900900
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
902902
class>`) subclass thereof. If *object* is not
903903
an object of the given type, the function always returns ``False``.
904904
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.
913913

914914
.. function:: issubclass(class, classinfo)
915915

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
917917
<abstract base class>`) of *classinfo*. A
918918
class is considered a subclass of itself. *classinfo* may be a tuple of class
919919
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.
10681068
.. class:: object()
10691069

10701070
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
10721072
function does not accept any arguments.
10731073

10741074
.. note::
@@ -1089,7 +1089,7 @@ are always available. They are listed here in alphabetical order.
10891089
>>> oct(-56)
10901090
'-0o70'
10911091

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
10931093
"0o" or not, you can use either of the following ways.
10941094

10951095
>>> '%#o' % 10, '%o' % 10
@@ -1113,16 +1113,16 @@ are always available. They are listed here in alphabetical order.
11131113
*file* is a :term:`path-like object` giving the pathname (absolute or
11141114
relative to the current working directory) of the file to be opened or an
11151115
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*
11171117
is set to ``False``.)
11181118

11191119
*mode* is an optional string that specifies the mode in which the file is
11201120
opened. It defaults to ``'r'`` which means open for reading in text mode.
11211121
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
11231123
(which on *some* Unix systems, means that *all* writes append to the end of
11241124
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:
11261126
``locale.getpreferredencoding(False)`` is called to get the current locale
11271127
encoding. (For reading and writing raw bytes use binary mode and leave
11281128
*encoding* unspecified.) The available modes are:
@@ -1138,13 +1138,13 @@ are always available. They are listed here in alphabetical order.
11381138
``'r'`` open for reading (default)
11391139
``'w'`` open for writing, truncating the file first
11401140
``'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
11421142
``'b'`` binary mode
11431143
``'t'`` text mode (default)
11441144
``'+'`` open for updating (reading and writing)
11451145
========= ===============================================================
11461146

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'``).
11481148
Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'``
11491149
and ``'r+b'`` open the file with no truncation.
11501150

@@ -1158,7 +1158,7 @@ are always available. They are listed here in alphabetical order.
11581158

11591159
There is an additional mode character permitted, ``'U'``, which no longer
11601160
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
11621162
in Python 3.0. Refer to the documentation of the
11631163
:ref:`newline <open-newline-parameter>` parameter for further details.
11641164

@@ -1250,8 +1250,8 @@ are always available. They are listed here in alphabetical order.
12501250

12511251
If *closefd* is ``False`` and a file descriptor rather than a filename was
12521252
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.
12551255

12561256
A custom opener can be used by passing a callable as *opener*. The underlying
12571257
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.
12951295
single: text mode
12961296
module: sys
12971297

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`
12991299
(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`,
13001300
and :mod:`shutil`.
13011301

@@ -1385,7 +1385,7 @@ are always available. They are listed here in alphabetical order.
13851385
.. function:: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False)
13861386

13871387
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
13891389
arguments.
13901390

13911391
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.
13991399
arguments are converted to text strings, :func:`print` cannot be used with
14001400
binary mode file objects. For these, use ``file.write(...)`` instead.
14011401

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
14031403
*flush* keyword argument is true, the stream is forcibly flushed.
14041404

14051405
.. versionchanged:: 3.3
@@ -1432,7 +1432,7 @@ are always available. They are listed here in alphabetical order.
14321432
x = property(getx, setx, delx, "I'm the 'x' property.")
14331433

14341434
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.
14361436

14371437
If given, *doc* will be the docstring of the property attribute. Otherwise, the
14381438
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.
14971497

14981498
Return a string containing a printable representation of an object. For many
14991499
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
15011501
representation is a string enclosed in angle brackets that contains the name
15021502
of the type of the object together with additional information often
15031503
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.
15251525
``2``). Any integer value is valid for *ndigits* (positive, zero, or
15261526
negative). The return value is an integer if *ndigits* is omitted or
15271527
``None``.
1528-
Otherwise the return value has the same type as *number*.
1528+
Otherwise, the return value has the same type as *number*.
15291529

15301530
For a general Python object ``number``, ``round`` delegates to
15311531
``number.__round__``.
@@ -1555,7 +1555,7 @@ are always available. They are listed here in alphabetical order.
15551555
.. function:: setattr(object, name, value)
15561556

15571557
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
15591559
new attribute. The function assigns the value to the attribute, provided the
15601560
object allows it. For example, ``setattr(x, 'foobar', 123)`` is equivalent to
15611561
``x.foobar = 123``.
@@ -1574,9 +1574,9 @@ are always available. They are listed here in alphabetical order.
15741574
Return a :term:`slice` object representing the set of indices specified by
15751575
``range(start, stop, step)``. The *start* and *step* arguments default to
15761576
``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
15781578
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.
15801580
Slice objects are also generated when extended indexing syntax is used. For
15811581
example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See
15821582
: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.
16231623
an instance (such as ``C().f()``). Moreover, they can be called as regular
16241624
functions (such as ``f()``).
16251625

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
16271627
:func:`classmethod` for a variant that is useful for creating alternate class
16281628
constructors.
16291629

@@ -1923,7 +1923,7 @@ are always available. They are listed here in alphabetical order.
19231923
and *locals* to determine how to interpret the name in a package context.
19241924
The *fromlist* gives the names of objects or submodules that should be
19251925
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
19271927
determine the package context of the :keyword:`import` statement.
19281928

19291929
*level* specifies whether to use absolute or relative imports. ``0`` (the

0 commit comments

Comments
 (0)