Skip to content

Commit 65f46e3

Browse files
committed
Deploying to gh-pages from @ 829aa71 🚀
1 parent 2b8f132 commit 65f46e3

File tree

542 files changed

+1141
-970
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

542 files changed

+1141
-970
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: ddf863800ca3d85a14f7248b3615d9ba
3+
config: 87517c73e5bb5c86c2cce0058423d149
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_sources/c-api/buffer.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
147147
or a :c:macro:`PyBUF_WRITABLE` request, the consumer must disregard
148148
:c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``.
149149

150-
.. c:member:: const char *format
150+
.. c:member:: char *format
151151
152-
A *NUL* terminated string in :mod:`struct` module style syntax describing
152+
A *NULL* terminated string in :mod:`struct` module style syntax describing
153153
the contents of a single item. If this is ``NULL``, ``"B"`` (unsigned bytes)
154154
is assumed.
155155

_sources/glossary.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,11 @@ Glossary
433433
An object that tries to find the :term:`loader` for a module that is
434434
being imported.
435435

436-
Since Python 3.3, there are two types of finder: :term:`meta path finders
436+
There are two types of finder: :term:`meta path finders
437437
<meta path finder>` for use with :data:`sys.meta_path`, and :term:`path
438438
entry finders <path entry finder>` for use with :data:`sys.path_hooks`.
439439

440-
See :pep:`302`, :pep:`420` and :pep:`451` for much more detail.
440+
See :ref:`importsystem` and :mod:`importlib` for much more detail.
441441

442442
floor division
443443
Mathematical division that rounds down to nearest integer. The floor

_sources/howto/pyporting.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ please see :ref:`cporting-howto`.
1818

1919
The archived python-porting_ mailing list may contain some useful guidance.
2020

21-
Since Python 3.13 the original porting guide was discontinued.
21+
Since Python 3.11 the original porting guide was discontinued.
2222
You can find the old guide in the
23-
`archive <https://docs.python.org/3.12/howto/pyporting.html>`_.
23+
`archive <https://docs.python.org/3.10/howto/pyporting.html>`_.
2424

2525

2626
Third-party guides

_sources/library/base64.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ The modern interface provides:
193193

194194
*wrapcol* controls whether the output should have newline (``b'\n'``)
195195
characters added to it. If this is non-zero, each output line will be
196-
at most this many characters long.
196+
at most this many characters long, excluding the trailing newline.
197197

198198
*pad* controls whether the input is padded to a multiple of 4
199199
before encoding. Note that the ``btoa`` implementation always pads.

_sources/library/cmath.rst.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ Conversions to and from polar coordinates
4343

4444
A Python complex number ``z`` is stored internally using *rectangular*
4545
or *Cartesian* coordinates. It is completely determined by its *real
46-
part* ``z.real`` and its *imaginary part* ``z.imag``. In other
47-
words::
48-
49-
z == z.real + z.imag*1j
46+
part* ``z.real`` and its *imaginary part* ``z.imag``.
5047

5148
*Polar coordinates* give an alternative way to represent a complex
5249
number. In polar coordinates, a complex number *z* is defined by the
@@ -90,7 +87,7 @@ rectangular coordinates to polar coordinates and back.
9087
.. function:: rect(r, phi)
9188

9289
Return the complex number *x* with polar coordinates *r* and *phi*.
93-
Equivalent to ``r * (math.cos(phi) + math.sin(phi)*1j)``.
90+
Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``.
9491

9592

9693
Power and logarithmic functions

_sources/library/contextlib.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ executing that callback::
796796
if result:
797797
stack.pop_all()
798798

799-
This allows the intended cleanup up behaviour to be made explicit up front,
799+
This allows the intended cleanup behaviour to be made explicit up front,
800800
rather than requiring a separate flag variable.
801801

802802
If a particular application uses this pattern a lot, it can be simplified

_sources/library/dataclasses.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ Module contents
459459

460460
.. function:: is_dataclass(obj)
461461

462-
Return ``True`` if its parameter is a dataclass or an instance of one,
463-
otherwise return ``False``.
462+
Return ``True`` if its parameter is a dataclass (including subclasses of a
463+
dataclass) or an instance of one, otherwise return ``False``.
464464

465465
If you need to know if a class is an instance of a dataclass (and
466466
not a dataclass itself), then add a further check for ``not

_sources/library/functions.rst.txt

Lines changed: 121 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,11 @@ are always available. They are listed here in alphabetical order.
141141
See also :func:`format` for more information.
142142

143143

144-
.. class:: bool(x=False)
144+
.. class:: bool(object=False, /)
145145

146-
Return a Boolean value, i.e. one of ``True`` or ``False``. *x* is converted
147-
using the standard :ref:`truth testing procedure <truth>`. If *x* is false
146+
Return a Boolean value, i.e. one of ``True`` or ``False``. The argument
147+
is converted using the standard :ref:`truth testing procedure <truth>`.
148+
If the argument is false
148149
or omitted, this returns ``False``; otherwise, it returns ``True``. The
149150
:class:`bool` class is a subclass of :class:`int` (see :ref:`typesnumeric`).
150151
It cannot be subclassed further. Its only instances are ``False`` and
@@ -153,7 +154,7 @@ are always available. They are listed here in alphabetical order.
153154
.. index:: pair: Boolean; type
154155

155156
.. versionchanged:: 3.7
156-
*x* is now a positional-only parameter.
157+
The parameter is now positional-only.
157158

158159
.. function:: breakpoint(*args, **kws)
159160

@@ -371,29 +372,73 @@ are always available. They are listed here in alphabetical order.
371372
support for top-level ``await``, ``async for``, and ``async with``.
372373

373374

374-
.. class:: complex(real=0, imag=0)
375-
complex(string)
375+
.. class:: complex(number=0, /)
376+
complex(string, /)
377+
complex(real=0, imag=0)
378+
379+
Convert a single string or number to a complex number, or create a
380+
complex number from real and imaginary parts.
381+
382+
Examples:
383+
384+
.. doctest::
385+
386+
>>> complex('+1.23')
387+
(1.23+0j)
388+
>>> complex('-4.5j')
389+
-4.5j
390+
>>> complex('-1.23+4.5j')
391+
(-1.23+4.5j)
392+
>>> complex('\t( -1.23+4.5J )\n')
393+
(-1.23+4.5j)
394+
>>> complex('-Infinity+NaNj')
395+
(-inf+nanj)
396+
>>> complex(1.23)
397+
(1.23+0j)
398+
>>> complex(imag=-4.5)
399+
-4.5j
400+
>>> complex(-1.23, 4.5)
401+
(-1.23+4.5j)
402+
403+
If the argument is a string, it must contain either a real part (in the
404+
same format as for :func:`float`) or an imaginary part (in the same
405+
format but with a ``'j'`` or ``'J'`` suffix), or both real and imaginary
406+
parts (the sign of the imaginary part is mandatory in this case).
407+
The string can optionally be surrounded by whitespaces and the round
408+
parentheses ``'('`` and ``')'``, which are ignored.
409+
The string must not contain whitespace between ``'+'``, ``'-'``, the
410+
``'j'`` or ``'J'`` suffix, and the decimal number.
411+
For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` raises
412+
:exc:`ValueError`.
413+
More precisely, the input must conform to the :token:`~float:complexvalue`
414+
production rule in the following grammar, after parentheses and leading and
415+
trailing whitespace characters are removed:
376416

377-
Return a complex number with the value *real* + *imag*\*1j or convert a string
378-
or number to a complex number. If the first parameter is a string, it will
379-
be interpreted as a complex number and the function must be called without a
380-
second parameter. The second parameter can never be a string. Each argument
381-
may be any numeric type (including complex). If *imag* is omitted, it
382-
defaults to zero and the constructor serves as a numeric conversion like
383-
:class:`int` and :class:`float`. If both arguments are omitted, returns
384-
``0j``.
417+
.. productionlist:: float
418+
complexvalue: `floatvalue` |
419+
: `floatvalue` ("j" | "J") |
420+
: `floatvalue` `sign` `absfloatvalue` ("j" | "J")
385421

422+
If the argument is a number, the constructor serves as a numeric
423+
conversion like :class:`int` and :class:`float`.
386424
For a general Python object ``x``, ``complex(x)`` delegates to
387-
``x.__complex__()``. If :meth:`~object.__complex__` is not defined then it falls back
388-
to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it falls back
425+
``x.__complex__()``.
426+
If :meth:`~object.__complex__` is not defined then it falls back
427+
to :meth:`~object.__float__`.
428+
If :meth:`!__float__` is not defined then it falls back
389429
to :meth:`~object.__index__`.
390430

391-
.. note::
431+
If two arguments are provided or keyword arguments are used, each argument
432+
may be any numeric type (including complex).
433+
If both arguments are real numbers, return a complex number with the real
434+
component *real* and the imaginary component *imag*.
435+
If both arguments are complex numbers, return a complex number with the real
436+
component ``real.real-imag.imag`` and the imaginary component
437+
``real.imag+imag.real``.
438+
If one of arguments is a real number, only its real component is used in
439+
the above expressions.
392440

393-
When converting from a string, the string must not contain whitespace
394-
around the central ``+`` or ``-`` operator. For example,
395-
``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` raises
396-
:exc:`ValueError`.
441+
If all arguments are omitted, returns ``0j``.
397442

398443
The complex type is described in :ref:`typesnumeric`.
399444

@@ -662,21 +707,38 @@ are always available. They are listed here in alphabetical order.
662707
elements of *iterable* for which *function* is false.
663708

664709

665-
.. class:: float(x=0.0)
710+
.. class:: float(number=0.0, /)
711+
float(string, /)
666712

667713
.. index::
668714
single: NaN
669715
single: Infinity
670716

671-
Return a floating point number constructed from a number or string *x*.
717+
Return a floating point number constructed from a number or a string.
718+
719+
Examples:
720+
721+
.. doctest::
722+
723+
>>> float('+1.23')
724+
1.23
725+
>>> float(' -12345\n')
726+
-12345.0
727+
>>> float('1e-003')
728+
0.001
729+
>>> float('+1E6')
730+
1000000.0
731+
>>> float('-Infinity')
732+
-inf
672733

673734
If the argument is a string, it should contain a decimal number, optionally
674735
preceded by a sign, and optionally embedded in whitespace. The optional
675736
sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value
676737
produced. The argument may also be a string representing a NaN
677-
(not-a-number), or positive or negative infinity. More precisely, the
678-
input must conform to the ``floatvalue`` production rule in the following
679-
grammar, after leading and trailing whitespace characters are removed:
738+
(not-a-number), or positive or negative infinity.
739+
More precisely, the input must conform to the :token:`~float:floatvalue`
740+
production rule in the following grammar, after leading and trailing
741+
whitespace characters are removed:
680742

681743
.. productionlist:: float
682744
sign: "+" | "-"
@@ -685,9 +747,10 @@ are always available. They are listed here in alphabetical order.
685747
digit: <a Unicode decimal digit, i.e. characters in Unicode general category Nd>
686748
digitpart: `digit` (["_"] `digit`)*
687749
number: [`digitpart`] "." `digitpart` | `digitpart` ["."]
688-
exponent: ("e" | "E") ["+" | "-"] `digitpart`
689-
floatnumber: number [`exponent`]
690-
floatvalue: [`sign`] (`floatnumber` | `infinity` | `nan`)
750+
exponent: ("e" | "E") [`sign`] `digitpart`
751+
floatnumber: `number` [`exponent`]
752+
absfloatvalue: `floatnumber` | `infinity` | `nan`
753+
floatvalue: [`sign`] `absfloatvalue`
691754

692755
Case is not significant, so, for example, "inf", "Inf", "INFINITY", and
693756
"iNfINity" are all acceptable spellings for positive infinity.
@@ -703,26 +766,13 @@ are always available. They are listed here in alphabetical order.
703766

704767
If no argument is given, ``0.0`` is returned.
705768

706-
Examples::
707-
708-
>>> float('+1.23')
709-
1.23
710-
>>> float(' -12345\n')
711-
-12345.0
712-
>>> float('1e-003')
713-
0.001
714-
>>> float('+1E6')
715-
1000000.0
716-
>>> float('-Infinity')
717-
-inf
718-
719769
The float type is described in :ref:`typesnumeric`.
720770

721771
.. versionchanged:: 3.6
722772
Grouping digits with underscores as in code literals is allowed.
723773

724774
.. versionchanged:: 3.7
725-
*x* is now a positional-only parameter.
775+
The parameter is now positional-only.
726776

727777
.. versionchanged:: 3.8
728778
Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not defined.
@@ -906,17 +956,36 @@ are always available. They are listed here in alphabetical order.
906956
with the result after successfully reading input.
907957

908958

909-
.. class:: int(x=0)
910-
int(x, base=10)
959+
.. class:: int(number=0, /)
960+
int(string, /, base=10)
961+
962+
Return an integer object constructed from a number or a string, or return
963+
``0`` if no arguments are given.
964+
965+
Examples:
966+
967+
.. doctest::
968+
969+
>>> int(123.45)
970+
123
971+
>>> int('123')
972+
123
973+
>>> int(' -12_345\n')
974+
-12345
975+
>>> int('FACE', 16)
976+
64206
977+
>>> int('0xface', 0)
978+
64206
979+
>>> int('01110011', base=2)
980+
115
911981

912-
Return an integer object constructed from a number or string *x*, or return
913-
``0`` if no arguments are given. If *x* defines :meth:`~object.__int__`,
914-
``int(x)`` returns ``x.__int__()``. If *x* defines :meth:`~object.__index__`,
915-
it returns ``x.__index__()``. If *x* defines :meth:`~object.__trunc__`,
982+
If the argument defines :meth:`~object.__int__`,
983+
``int(x)`` returns ``x.__int__()``. If the argument defines :meth:`~object.__index__`,
984+
it returns ``x.__index__()``. If the argument defines :meth:`~object.__trunc__`,
916985
it returns ``x.__trunc__()``.
917986
For floating point numbers, this truncates towards zero.
918987

919-
If *x* is not a number or if *base* is given, then *x* must be a string,
988+
If the argument is not a number or if *base* is given, then it must be a string,
920989
:class:`bytes`, or :class:`bytearray` instance representing an integer
921990
in radix *base*. Optionally, the string can be preceded by ``+`` or ``-``
922991
(with no space in between), have leading zeros, be surrounded by whitespace,
@@ -946,7 +1015,7 @@ are always available. They are listed here in alphabetical order.
9461015
Grouping digits with underscores as in code literals is allowed.
9471016

9481017
.. versionchanged:: 3.7
949-
*x* is now a positional-only parameter.
1018+
The first parameter is now positional-only.
9501019

9511020
.. versionchanged:: 3.8
9521021
Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not defined.
@@ -957,7 +1026,7 @@ are always available. They are listed here in alphabetical order.
9571026
.. versionchanged:: 3.11
9581027
:class:`int` string inputs and string representations can be limited to
9591028
help avoid denial of service attacks. A :exc:`ValueError` is raised when
960-
the limit is exceeded while converting a string *x* to an :class:`int` or
1029+
the limit is exceeded while converting a string to an :class:`int` or
9611030
when converting an :class:`int` into a string would exceed the limit.
9621031
See the :ref:`integer string conversion length limitation
9631032
<int_max_str_digits>` documentation.

0 commit comments

Comments
 (0)