mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Python 3.13.10
This commit is contained in:
parent
a62caed6a6
commit
4fd884356d
89 changed files with 993 additions and 243 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Autogenerated by Sphinx on Tue Oct 14 15:52:27 2025
|
||||
# Autogenerated by Sphinx on Tue Dec 2 13:49:46 2025
|
||||
# as part of the release process.
|
||||
|
||||
topics = {
|
||||
|
|
@ -1042,10 +1042,10 @@ class and instance attributes applies as for regular assignments.
|
|||
'bltin-ellipsis-object': r'''The Ellipsis Object
|
||||
*******************
|
||||
|
||||
This object is commonly used used to indicate that something is
|
||||
omitted. It supports no special operations. There is exactly one
|
||||
ellipsis object, named "Ellipsis" (a built-in name).
|
||||
"type(Ellipsis)()" produces the "Ellipsis" singleton.
|
||||
This object is commonly used to indicate that something is omitted. It
|
||||
supports no special operations. There is exactly one ellipsis object,
|
||||
named "Ellipsis" (a built-in name). "type(Ellipsis)()" produces the
|
||||
"Ellipsis" singleton.
|
||||
|
||||
It is written as "Ellipsis" or "...".
|
||||
|
||||
|
|
@ -2612,7 +2612,7 @@ class attributes; they are shared by instances. Instance attributes
|
|||
If only keyword patterns are present, they are processed as
|
||||
follows, one by one:
|
||||
|
||||
I. The keyword is looked up as an attribute on the subject.
|
||||
1. The keyword is looked up as an attribute on the subject.
|
||||
|
||||
* If this raises an exception other than "AttributeError", the
|
||||
exception bubbles up.
|
||||
|
|
@ -2624,14 +2624,14 @@ class attributes; they are shared by instances. Instance attributes
|
|||
the class pattern fails; if this succeeds, the match proceeds
|
||||
to the next keyword.
|
||||
|
||||
II. If all keyword patterns succeed, the class pattern succeeds.
|
||||
2. If all keyword patterns succeed, the class pattern succeeds.
|
||||
|
||||
If any positional patterns are present, they are converted to
|
||||
keyword patterns using the "__match_args__" attribute on the class
|
||||
"name_or_attr" before matching:
|
||||
|
||||
I. The equivalent of "getattr(cls, "__match_args__", ())" is
|
||||
called.
|
||||
1. The equivalent of "getattr(cls, "__match_args__", ())" is
|
||||
called.
|
||||
|
||||
* If this raises an exception, the exception bubbles up.
|
||||
|
||||
|
|
@ -2652,9 +2652,9 @@ class attributes; they are shared by instances. Instance attributes
|
|||
|
||||
Customizing positional arguments in class pattern matching
|
||||
|
||||
II. Once all positional patterns have been converted to keyword
|
||||
patterns,
|
||||
the match proceeds as if there were only keyword patterns.
|
||||
2. Once all positional patterns have been converted to keyword
|
||||
patterns, the match proceeds as if there were only keyword
|
||||
patterns.
|
||||
|
||||
For the following built-in types the handling of positional
|
||||
subpatterns is different:
|
||||
|
|
@ -3818,6 +3818,10 @@ def double(x):
|
|||
available for commands and command arguments, e.g. the current global
|
||||
and local names are offered as arguments of the "p" command.
|
||||
|
||||
|
||||
Command-line interface
|
||||
======================
|
||||
|
||||
You can also invoke "pdb" from the command line to debug other
|
||||
scripts. For example:
|
||||
|
||||
|
|
@ -3833,7 +3837,7 @@ def double(x):
|
|||
-c, --command <command>
|
||||
|
||||
To execute commands as if given in a ".pdbrc" file; see Debugger
|
||||
Commands.
|
||||
commands.
|
||||
|
||||
Changed in version 3.2: Added the "-c" option.
|
||||
|
||||
|
|
@ -3976,7 +3980,7 @@ class pdb.Pdb(completekey='tab', stdin=None, stdout=None, skip=None, nosigint=Fa
|
|||
See the documentation for the functions explained above.
|
||||
|
||||
|
||||
Debugger Commands
|
||||
Debugger commands
|
||||
=================
|
||||
|
||||
The commands recognized by the debugger are listed below. Most
|
||||
|
|
@ -6781,9 +6785,8 @@ class that has an "__add__()" method, "type(x).__add__(x, y)" is
|
|||
*************************
|
||||
|
||||
*Objects* are Python’s abstraction for data. All data in a Python
|
||||
program is represented by objects or by relations between objects. (In
|
||||
a sense, and in conformance to Von Neumann’s model of a “stored
|
||||
program computer”, code is also represented by objects.)
|
||||
program is represented by objects or by relations between objects.
|
||||
Even code is represented by objects.
|
||||
|
||||
Every object has an identity, a type and a value. An object’s
|
||||
*identity* never changes once it has been created; you may think of it
|
||||
|
|
@ -7170,21 +7173,24 @@ class C: pass # a class with no methods (yet)
|
|||
The "collections.abc" module provides a "MutableMapping" *abstract
|
||||
base class* to help create those methods from a base set of
|
||||
"__getitem__()", "__setitem__()", "__delitem__()", and "keys()".
|
||||
Mutable sequences should provide methods "append()", "count()",
|
||||
"index()", "extend()", "insert()", "pop()", "remove()", "reverse()"
|
||||
and "sort()", like Python standard "list" objects. Finally, sequence
|
||||
|
||||
Mutable sequences should provide methods "append()", "clear()",
|
||||
"count()", "extend()", "index()", "insert()", "pop()", "remove()", and
|
||||
"reverse()", like Python standard "list" objects. Finally, sequence
|
||||
types should implement addition (meaning concatenation) and
|
||||
multiplication (meaning repetition) by defining the methods
|
||||
"__add__()", "__radd__()", "__iadd__()", "__mul__()", "__rmul__()" and
|
||||
"__imul__()" described below; they should not define other numerical
|
||||
operators. It is recommended that both mappings and sequences
|
||||
implement the "__contains__()" method to allow efficient use of the
|
||||
"in" operator; for mappings, "in" should search the mapping’s keys;
|
||||
for sequences, it should search through the values. It is further
|
||||
recommended that both mappings and sequences implement the
|
||||
"__iter__()" method to allow efficient iteration through the
|
||||
container; for mappings, "__iter__()" should iterate through the
|
||||
object’s keys; for sequences, it should iterate through the values.
|
||||
operators.
|
||||
|
||||
It is recommended that both mappings and sequences implement the
|
||||
"__contains__()" method to allow efficient use of the "in" operator;
|
||||
for mappings, "in" should search the mapping’s keys; for sequences, it
|
||||
should search through the values. It is further recommended that both
|
||||
mappings and sequences implement the "__iter__()" method to allow
|
||||
efficient iteration through the container; for mappings, "__iter__()"
|
||||
should iterate through the object’s keys; for sequences, it should
|
||||
iterate through the values.
|
||||
|
||||
object.__len__(self)
|
||||
|
||||
|
|
@ -8532,21 +8538,24 @@ class of a class is known as that class’s *metaclass*, and most
|
|||
The "collections.abc" module provides a "MutableMapping" *abstract
|
||||
base class* to help create those methods from a base set of
|
||||
"__getitem__()", "__setitem__()", "__delitem__()", and "keys()".
|
||||
Mutable sequences should provide methods "append()", "count()",
|
||||
"index()", "extend()", "insert()", "pop()", "remove()", "reverse()"
|
||||
and "sort()", like Python standard "list" objects. Finally, sequence
|
||||
|
||||
Mutable sequences should provide methods "append()", "clear()",
|
||||
"count()", "extend()", "index()", "insert()", "pop()", "remove()", and
|
||||
"reverse()", like Python standard "list" objects. Finally, sequence
|
||||
types should implement addition (meaning concatenation) and
|
||||
multiplication (meaning repetition) by defining the methods
|
||||
"__add__()", "__radd__()", "__iadd__()", "__mul__()", "__rmul__()" and
|
||||
"__imul__()" described below; they should not define other numerical
|
||||
operators. It is recommended that both mappings and sequences
|
||||
implement the "__contains__()" method to allow efficient use of the
|
||||
"in" operator; for mappings, "in" should search the mapping’s keys;
|
||||
for sequences, it should search through the values. It is further
|
||||
recommended that both mappings and sequences implement the
|
||||
"__iter__()" method to allow efficient iteration through the
|
||||
container; for mappings, "__iter__()" should iterate through the
|
||||
object’s keys; for sequences, it should iterate through the values.
|
||||
operators.
|
||||
|
||||
It is recommended that both mappings and sequences implement the
|
||||
"__contains__()" method to allow efficient use of the "in" operator;
|
||||
for mappings, "in" should search the mapping’s keys; for sequences, it
|
||||
should search through the values. It is further recommended that both
|
||||
mappings and sequences implement the "__iter__()" method to allow
|
||||
efficient iteration through the container; for mappings, "__iter__()"
|
||||
should iterate through the object’s keys; for sequences, it should
|
||||
iterate through the values.
|
||||
|
||||
object.__len__(self)
|
||||
|
||||
|
|
@ -9188,10 +9197,14 @@ class is used in a class pattern with positional arguments, each
|
|||
the numeric index of a positional argument, or the name of a
|
||||
keyword argument. Returns a copy of the string where each
|
||||
replacement field is replaced with the string value of the
|
||||
corresponding argument.
|
||||
corresponding argument. For example:
|
||||
|
||||
>>> "The sum of 1 + 2 is {0}".format(1+2)
|
||||
'The sum of 1 + 2 is 3'
|
||||
>>> "The sum of 1 + 2 is {0}".format(1+2)
|
||||
'The sum of 1 + 2 is 3'
|
||||
>>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
|
||||
'The sum of 1 + 2 is 3'
|
||||
>>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
|
||||
'Nobody expects the Spanish Inquisition!'
|
||||
|
||||
See Format String Syntax for a description of the various
|
||||
formatting options that can be specified in format strings.
|
||||
|
|
@ -9246,13 +9259,28 @@ class is used in a class pattern with positional arguments, each
|
|||
database as “Letter”, i.e., those with general category property
|
||||
being one of “Lm”, “Lt”, “Lu”, “Ll”, or “Lo”. Note that this is
|
||||
different from the Alphabetic property defined in the section 4.10
|
||||
‘Letters, Alphabetic, and Ideographic’ of the Unicode Standard.
|
||||
‘Letters, Alphabetic, and Ideographic’ of the Unicode Standard. For
|
||||
example:
|
||||
|
||||
>>> 'Letters and spaces'.isalpha()
|
||||
False
|
||||
>>> 'LettersOnly'.isalpha()
|
||||
True
|
||||
>>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical too
|
||||
True
|
||||
|
||||
See Unicode Properties.
|
||||
|
||||
str.isascii()
|
||||
|
||||
Return "True" if the string is empty or all characters in the
|
||||
string are ASCII, "False" otherwise. ASCII characters have code
|
||||
points in the range U+0000-U+007F.
|
||||
points in the range U+0000-U+007F. For example:
|
||||
|
||||
>>> 'ASCII characters'.isascii()
|
||||
True
|
||||
>>> 'µ'.isascii()
|
||||
False
|
||||
|
||||
Added in version 3.7.
|
||||
|
||||
|
|
@ -9261,8 +9289,16 @@ class is used in a class pattern with positional arguments, each
|
|||
Return "True" if all characters in the string are decimal
|
||||
characters and there is at least one character, "False" otherwise.
|
||||
Decimal characters are those that can be used to form numbers in
|
||||
base 10, e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a decimal
|
||||
character is a character in the Unicode General Category “Nd”.
|
||||
base 10, such as U+0660, ARABIC-INDIC DIGIT ZERO. Formally a
|
||||
decimal character is a character in the Unicode General Category
|
||||
“Nd”. For example:
|
||||
|
||||
>>> '0123456789'.isdecimal()
|
||||
True
|
||||
>>> '٠١٢٣٤٥٦٧٨٩'.isdecimal() # Arabic-Indic digits zero to nine
|
||||
True
|
||||
>>> 'alphabetic'.isdecimal()
|
||||
False
|
||||
|
||||
str.isdigit()
|
||||
|
||||
|
|
@ -9340,6 +9376,17 @@ class is used in a class pattern with positional arguments, each
|
|||
follow uncased characters and lowercase characters only cased ones.
|
||||
Return "False" otherwise.
|
||||
|
||||
For example:
|
||||
|
||||
>>> 'Spam, Spam, Spam'.istitle()
|
||||
True
|
||||
>>> 'spam, spam, spam'.istitle()
|
||||
False
|
||||
>>> 'SPAM, SPAM, SPAM'.istitle()
|
||||
False
|
||||
|
||||
See also "title()".
|
||||
|
||||
str.isupper()
|
||||
|
||||
Return "True" if all cased characters [4] in the string are
|
||||
|
|
@ -9360,7 +9407,15 @@ class is used in a class pattern with positional arguments, each
|
|||
Return a string which is the concatenation of the strings in
|
||||
*iterable*. A "TypeError" will be raised if there are any non-
|
||||
string values in *iterable*, including "bytes" objects. The
|
||||
separator between elements is the string providing this method.
|
||||
separator between elements is the string providing this method. For
|
||||
example:
|
||||
|
||||
>>> ', '.join(['spam', 'spam', 'spam'])
|
||||
'spam, spam, spam'
|
||||
>>> '-'.join('Python')
|
||||
'P-y-t-h-o-n'
|
||||
|
||||
See also "split()".
|
||||
|
||||
str.ljust(width, fillchar=' ', /)
|
||||
|
||||
|
|
@ -9570,6 +9625,8 @@ class is used in a class pattern with positional arguments, each
|
|||
>>> " foo ".split(maxsplit=0)
|
||||
['foo ']
|
||||
|
||||
See also "join()".
|
||||
|
||||
str.splitlines(keepends=False)
|
||||
|
||||
Return a list of the lines in the string, breaking at line
|
||||
|
|
@ -9702,6 +9759,8 @@ class is used in a class pattern with positional arguments, each
|
|||
>>> titlecase("they're bill's friends.")
|
||||
"They're Bill's Friends."
|
||||
|
||||
See also "istitle()".
|
||||
|
||||
str.translate(table, /)
|
||||
|
||||
Return a copy of the string in which each character has been mapped
|
||||
|
|
@ -11049,6 +11108,11 @@ class method object, it is transformed into an instance method object
|
|||
| | "X.__bases__" will be exactly equal to "(A, B, |
|
||||
| | C)". |
|
||||
+----------------------------------------------------+----------------------------------------------------+
|
||||
| type.__base__ | **CPython implementation detail:** The single base |
|
||||
| | class in the inheritance chain that is responsible |
|
||||
| | for the memory layout of instances. This attribute |
|
||||
| | corresponds to "tp_base" at the C level. |
|
||||
+----------------------------------------------------+----------------------------------------------------+
|
||||
| type.__doc__ | The class’s documentation string, or "None" if |
|
||||
| | undefined. Not inherited by subclasses. |
|
||||
+----------------------------------------------------+----------------------------------------------------+
|
||||
|
|
@ -11691,8 +11755,8 @@ class dict(iterable, /, **kwargs)
|
|||
1
|
||||
|
||||
The example above shows part of the implementation of
|
||||
"collections.Counter". A different "__missing__" method is used
|
||||
by "collections.defaultdict".
|
||||
"collections.Counter". A different "__missing__()" method is
|
||||
used by "collections.defaultdict".
|
||||
|
||||
d[key] = value
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue