-# Autogenerated by Sphinx on Thu Aug 14 13:12:07 2025
+# Autogenerated by Sphinx on Tue Oct 7 14:01:47 2025
# as part of the release process.
topics = {
Customizing module attribute access
===================================
+module.__getattr__()
+module.__dir__()
+
Special names "__getattr__" and "__dir__" can be also used to
customize access to module attributes. The "__getattr__" function at
the module level should accept one argument which is the name of an
present, this function overrides the standard "dir()" search on a
module.
+module.__class__
+
For a more fine grained customization of the module behavior (setting
attributes, properties, etc.), one can set the "__class__" attribute
of a module object to a subclass of "types.ModuleType". For example:
'bltin-ellipsis-object': r'''The Ellipsis Object
*******************
-This object is commonly used by slicing (see Slicings). 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 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 "...".
+
+In typical use, "..." as the "Ellipsis" object appears in a few
+different places, for instance:
+
+* In type annotations, such as callable arguments or tuple elements.
+
+* As the body of a function instead of a pass statement.
+
+* In third-party libraries, such as Numpy’s slicing and striding.
+
+Python also uses three dots in ways that are not "Ellipsis" objects,
+for instance:
+
+* Doctest’s "ELLIPSIS", as a pattern for missing content.
+
+* The default Python prompt of the *interactive* shell when partial
+ input is incomplete.
+
+Lastly, the Python documentation often uses three dots in conventional
+English usage to mean omitted content, even in code examples that also
+use them as the "Ellipsis".
''',
'bltin-null-object': r'''The Null Object
***************
"except*" clause
----------------
-The "except*" clause(s) are used for handling "ExceptionGroup"s. The
-exception type for matching is interpreted as in the case of "except",
-but in the case of exception groups we can have partial matches when
-the type matches some of the exceptions in the group. This means that
-multiple "except*" clauses can execute, each handling part of the
-exception group. Each clause executes at most once and handles an
-exception group of all matching exceptions. Each exception in the
-group is handled by at most one "except*" clause, the first that
-matches it.
+The "except*" clause(s) specify one or more handlers for groups of
+exceptions ("BaseExceptionGroup" instances). A "try" statement can
+have either "except" or "except*" clauses, but not both. The exception
+type for matching is mandatory in the case of "except*", so "except*:"
+is a syntax error. The type is interpreted as in the case of "except",
+but matching is performed on the exceptions contained in the group
+that is being handled. An "TypeError" is raised if a matching type is
+a subclass of "BaseExceptionGroup", because that would have ambiguous
+semantics.
+
+When an exception group is raised in the try block, each "except*"
+clause splits (see "split()") it into the subgroups of matching and
+non-matching exceptions. If the matching subgroup is not empty, it
+becomes the handled exception (the value returned from
+"sys.exception()") and assigned to the target of the "except*" clause
+(if there is one). Then, the body of the "except*" clause executes. If
+the non-matching subgroup is not empty, it is processed by the next
+"except*" in the same manner. This continues until all exceptions in
+the group have been matched, or the last "except*" clause has run.
+
+After all "except*" clauses execute, the group of unhandled exceptions
+is merged with any exceptions that were raised or re-raised from
+within "except*" clauses. This merged exception group propagates on.:
>>> try:
... raise ExceptionGroup("eg",
caught <class 'ExceptionGroup'> with nested (TypeError(2),)
caught <class 'ExceptionGroup'> with nested (OSError(3), OSError(4))
+ Exception Group Traceback (most recent call last):
- | File "<stdin>", line 2, in <module>
- | ExceptionGroup: eg
+ | File "<doctest default[0]>", line 2, in <module>
+ | raise ExceptionGroup("eg",
+ | [ValueError(1), TypeError(2), OSError(3), OSError(4)])
+ | ExceptionGroup: eg (1 sub-exception)
+-+---------------- 1 ----------------
| ValueError: 1
+------------------------------------
-Any remaining exceptions that were not handled by any "except*" clause
-are re-raised at the end, along with all exceptions that were raised
-from within the "except*" clauses. If this list contains more than one
-exception to reraise, they are combined into an exception group.
-
-If the raised exception is not an exception group and its type matches
-one of the "except*" clauses, it is caught and wrapped by an exception
-group with an empty message string.
+If the exception raised from the "try" block is not an exception group
+and its type matches one of the "except*" clauses, it is caught and
+wrapped by an exception group with an empty message string. This
+ensures that the type of the target "e" is consistently
+"BaseExceptionGroup":
>>> try:
... raise BlockingIOError
...
ExceptionGroup('', (BlockingIOError()))
-An "except*" clause must have a matching expression; it cannot be
-"except*:". Furthermore, this expression cannot contain exception
-group types, because that would have ambiguous semantics.
-
-It is not possible to mix "except" and "except*" in the same "try".
-The "break", "continue", and "return" statements cannot appear in an
-"except*" clause.
+"break", "continue" and "return" cannot appear in an "except*" clause.
"else" clause
----------------
If "finally" is present, it specifies a ‘cleanup’ handler. The "try"
-clause is executed, including any "except" and "else" clauses. If an
+clause is executed, including any "except" and "else" clauses. If an
exception occurs in any of the clauses and is not handled, the
exception is temporarily saved. The "finally" clause is executed. If
there is a saved exception it is re-raised at the end of the "finally"
-clause. If the "finally" clause raises another exception, the saved
+clause. If the "finally" clause raises another exception, the saved
exception is set as the context of the new exception. If the "finally"
clause executes a "return", "break" or "continue" statement, the saved
exception is discarded:
Deletion of a name removes the binding of that name from the local or
global namespace, depending on whether the name occurs in a "global"
-statement in the same code block. If the name is unbound, a
-"NameError" exception will be raised.
+statement in the same code block. Trying to delete an unbound name
+raises a "NameError" exception.
Deletion of attribute references, subscriptions and slicings is passed
to the primary object involved; deletion of a slicing is in general
without "global", although free variables may refer to globals without
being declared global.
-The "global" statement applies to the entire scope of a function or
-class body. A "SyntaxError" is raised if a variable is used or
-assigned to prior to its global declaration in the scope.
+The "global" statement applies to the entire current scope (module,
+function body or class definition). A "SyntaxError" is raised if a
+variable is used or assigned to prior to its global declaration in the
+scope.
+
+At the module level, all variables are global, so a "global" statement
+has no effect. However, variables must still not be used or assigned
+to prior to their "global" declaration. This requirement is relaxed in
+the interactive prompt (*REPL*).
**Programmer’s note:** "global" is a directive to the parser. It
applies only to code parsed at the same time as the "global"
Customizing module attribute access
-----------------------------------
+module.__getattr__()
+module.__dir__()
+
Special names "__getattr__" and "__dir__" can be also used to
customize access to module attributes. The "__getattr__" function at
the module level should accept one argument which is the name of an
present, this function overrides the standard "dir()" search on a
module.
+module.__class__
+
For a more fine grained customization of the module behavior (setting
attributes, properties, etc.), one can set the "__class__" attribute
of a module object to a subclass of "types.ModuleType". For example:
Added in version 3.3.
-str.center(width[, fillchar])
+str.center(width, fillchar=' ', /)
Return centered in a string of length *width*. Padding is done
using the specified *fillchar* (default is an ASCII space). The
Return the lowest index in the string where substring *sub* is
found within the slice "s[start:end]". Optional arguments *start*
and *end* are interpreted as in slice notation. Return "-1" if
- *sub* is not found.
+ *sub* is not found. For example:
+
+ >>> 'spam, spam, spam'.find('sp')
+ 0
+ >>> 'spam, spam, spam'.find('sp', 5)
+ 6
+
+ See also "rfind()" and "index()".
Note:
>>> ' '.isupper()
False
-str.join(iterable)
+str.join(iterable, /)
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.
-str.ljust(width[, fillchar])
+str.ljust(width, fillchar=' ', /)
Return the string left justified in a string of length *width*.
Padding is done using the specified *fillchar* (default is an ASCII
The lowercasing algorithm used is described in section 3.13
‘Default Case Folding’ of the Unicode Standard.
-str.lstrip([chars])
+str.lstrip(chars=None, /)
Return a copy of the string with leading characters removed. The
*chars* argument is a string specifying the set of characters to be
>>> 'Arthur: three!'.removeprefix('Arthur: ')
'three!'
-static str.maketrans(x[, y[, z]])
+static str.maketrans(dict, /)
+static str.maketrans(from, to, remove='', /)
This static method returns a translation table usable for
"str.translate()".
Character keys will then be converted to ordinals.
If there are two arguments, they must be strings of equal length,
- and in the resulting dictionary, each character in x will be mapped
- to the character at the same position in y. If there is a third
- argument, it must be a string, whose characters will be mapped to
- "None" in the result.
+ and in the resulting dictionary, each character in *from* will be
+ mapped to the character at the same position in *to*. If there is
+ a third argument, it must be a string, whose characters will be
+ mapped to "None" in the result.
-str.partition(sep)
+str.partition(sep, /)
Split the string at the first occurrence of *sep*, and return a
3-tuple containing the part before the separator, the separator
Added in version 3.9.
-str.replace(old, new, count=-1)
+str.replace(old, new, /, count=-1)
Return a copy of the string with all occurrences of substring *old*
replaced by *new*. If *count* is given, only the first *count*
Like "rfind()" but raises "ValueError" when the substring *sub* is
not found.
-str.rjust(width[, fillchar])
+str.rjust(width, fillchar=' ', /)
Return the string right justified in a string of length *width*.
Padding is done using the specified *fillchar* (default is an ASCII
space). The original string is returned if *width* is less than or
equal to "len(s)".
-str.rpartition(sep)
+str.rpartition(sep, /)
Split the string at the last occurrence of *sep*, and return a
3-tuple containing the part before the separator, the separator
from the right, "rsplit()" behaves like "split()" which is
described in detail below.
-str.rstrip([chars])
+str.rstrip(chars=None, /)
Return a copy of the string with trailing characters removed. The
*chars* argument is a string specifying the set of characters to be
With optional *start*, test string beginning at that position.
With optional *end*, stop comparing string at that position.
-str.strip([chars])
+str.strip(chars=None, /)
Return a copy of the string with the leading and trailing
characters removed. The *chars* argument is a string specifying the
>>> titlecase("they're bill's friends.")
"They're Bill's Friends."
-str.translate(table)
+str.translate(table, /)
Return a copy of the string in which each character has been mapped
through the given translation table. The table must be an object
The uppercasing algorithm used is described in section 3.13
‘Default Case Folding’ of the Unicode Standard.
-str.zfill(width)
+str.zfill(width, /)
Return a copy of the string left filled with ASCII "'0'" digits to
make a string of length *width*. A leading sign prefix
"except*" clause
================
-The "except*" clause(s) are used for handling "ExceptionGroup"s. The
-exception type for matching is interpreted as in the case of "except",
-but in the case of exception groups we can have partial matches when
-the type matches some of the exceptions in the group. This means that
-multiple "except*" clauses can execute, each handling part of the
-exception group. Each clause executes at most once and handles an
-exception group of all matching exceptions. Each exception in the
-group is handled by at most one "except*" clause, the first that
-matches it.
+The "except*" clause(s) specify one or more handlers for groups of
+exceptions ("BaseExceptionGroup" instances). A "try" statement can
+have either "except" or "except*" clauses, but not both. The exception
+type for matching is mandatory in the case of "except*", so "except*:"
+is a syntax error. The type is interpreted as in the case of "except",
+but matching is performed on the exceptions contained in the group
+that is being handled. An "TypeError" is raised if a matching type is
+a subclass of "BaseExceptionGroup", because that would have ambiguous
+semantics.
+
+When an exception group is raised in the try block, each "except*"
+clause splits (see "split()") it into the subgroups of matching and
+non-matching exceptions. If the matching subgroup is not empty, it
+becomes the handled exception (the value returned from
+"sys.exception()") and assigned to the target of the "except*" clause
+(if there is one). Then, the body of the "except*" clause executes. If
+the non-matching subgroup is not empty, it is processed by the next
+"except*" in the same manner. This continues until all exceptions in
+the group have been matched, or the last "except*" clause has run.
+
+After all "except*" clauses execute, the group of unhandled exceptions
+is merged with any exceptions that were raised or re-raised from
+within "except*" clauses. This merged exception group propagates on.:
>>> try:
... raise ExceptionGroup("eg",
caught <class 'ExceptionGroup'> with nested (TypeError(2),)
caught <class 'ExceptionGroup'> with nested (OSError(3), OSError(4))
+ Exception Group Traceback (most recent call last):
- | File "<stdin>", line 2, in <module>
- | ExceptionGroup: eg
+ | File "<doctest default[0]>", line 2, in <module>
+ | raise ExceptionGroup("eg",
+ | [ValueError(1), TypeError(2), OSError(3), OSError(4)])
+ | ExceptionGroup: eg (1 sub-exception)
+-+---------------- 1 ----------------
| ValueError: 1
+------------------------------------
-Any remaining exceptions that were not handled by any "except*" clause
-are re-raised at the end, along with all exceptions that were raised
-from within the "except*" clauses. If this list contains more than one
-exception to reraise, they are combined into an exception group.
-
-If the raised exception is not an exception group and its type matches
-one of the "except*" clauses, it is caught and wrapped by an exception
-group with an empty message string.
+If the exception raised from the "try" block is not an exception group
+and its type matches one of the "except*" clauses, it is caught and
+wrapped by an exception group with an empty message string. This
+ensures that the type of the target "e" is consistently
+"BaseExceptionGroup":
>>> try:
... raise BlockingIOError
...
ExceptionGroup('', (BlockingIOError()))
-An "except*" clause must have a matching expression; it cannot be
-"except*:". Furthermore, this expression cannot contain exception
-group types, because that would have ambiguous semantics.
-
-It is not possible to mix "except" and "except*" in the same "try".
-The "break", "continue", and "return" statements cannot appear in an
-"except*" clause.
+"break", "continue" and "return" cannot appear in an "except*" clause.
"else" clause
================
If "finally" is present, it specifies a ‘cleanup’ handler. The "try"
-clause is executed, including any "except" and "else" clauses. If an
+clause is executed, including any "except" and "else" clauses. If an
exception occurs in any of the clauses and is not handled, the
exception is temporarily saved. The "finally" clause is executed. If
there is a saved exception it is re-raised at the end of the "finally"
-clause. If the "finally" clause raises another exception, the saved
+clause. If the "finally" clause raises another exception, the saved
exception is set as the context of the new exception. If the "finally"
clause executes a "return", "break" or "continue" statement, the saved
exception is discarded:
dictionary entry.
class dict(**kwargs)
-class dict(mapping, **kwargs)
-class dict(iterable, **kwargs)
+class dict(mapping, /, **kwargs)
+class dict(iterable, /, **kwargs)
Return a new dictionary initialized from an optional positional
argument and a possibly empty set of keyword arguments.
Return a new view of the dictionary’s keys. See the
documentation of view objects.
- pop(key[, default])
+ pop(key, /)
+ pop(key, default, /)
If *key* is in the dictionary, remove it and return its value,
else return *default*. If *default* is not given and *key* is
*key* with a value of *default* and return *default*. *default*
defaults to "None".
- update([other])
+ update(**kwargs)
+ update(mapping, /, **kwargs)
+ update(iterable, /, **kwargs)
- Update the dictionary with the key/value pairs from *other*,
- overwriting existing keys. Return "None".
+ Update the dictionary with the key/value pairs from *mapping* or
+ *iterable* and *kwargs*, overwriting existing keys. Return
+ "None".
"update()" accepts either another object with a "keys()" method
(in which case "__getitem__()" is called with every key returned
| "s * n" or "n * s" | equivalent to adding *s* to | (2)(7) |
| | itself *n* times | |
+----------------------------+----------------------------------+------------+
-| "s[i]" | *i*th item of *s*, origin 0 | (3)(9) |
+| "s[i]" | *i*th item of *s*, origin 0 | (3)(8) |
+----------------------------+----------------------------------+------------+
| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |
+----------------------------+----------------------------------+------------+
+----------------------------+----------------------------------+------------+
| "max(s)" | largest item of *s* | |
+----------------------------+----------------------------------+------------+
-| "s.index(x[, i[, j]])" | index of the first occurrence of | (8) |
-| | *x* in *s* (at or after index | |
-| | *i* and before index *j*) | |
-+----------------------------+----------------------------------+------------+
-| "s.count(x)" | total number of occurrences of | |
-| | *x* in *s* | |
-+----------------------------+----------------------------------+------------+
Sequences of the same type also support comparisons. In particular,
tuples and lists are compared lexicographically by comparing
that follow specific patterns, and hence don’t support sequence
concatenation or repetition.
-8. "index" raises "ValueError" when *x* is not found in *s*. Not all
- implementations support passing the additional arguments *i* and
- *j*. These arguments allow efficient searching of subsections of
- the sequence. Passing the extra arguments is roughly equivalent to
- using "s[i:j].index(x)", only without copying any data and with the
- returned index being relative to the start of the sequence rather
- than the start of the slice.
+8. An "IndexError" is raised if *i* is outside the sequence range.
+
+-[ Sequence Methods ]-
-9. An "IndexError" is raised if *i* is outside the sequence range.
+Sequence types also support the following methods:
+
+sequence.count(value, /)
+
+ Return the total number of occurrences of *value* in *sequence*.
+
+sequence.index(value[, start[, stop])
+
+ Return the index of the first occurrence of *value* in *sequence*.
+
+ Raises "ValueError" if *value* is not found in *sequence*.
+
+ The *start* or *stop* arguments allow for efficient searching of
+ subsections of the sequence, beginning at *start* and ending at
+ *stop*. This is roughly equivalent to "start +
+ sequence[start:stop].index(value)", only without copying any data.
+
+ Caution:
+
+ Not all sequence types support passing the *start* and *stop*
+ arguments.
Immutable Sequence Types
| "del s[i:j:k]" | removes the elements of | |
| | "s[i:j:k]" from the list | |
+--------------------------------+----------------------------------+-----------------------+
-| "s.append(x)" | appends *x* to the end of the | |
-| | sequence (same as | |
-| | "s[len(s):len(s)] = [x]") | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.clear()" | removes all items from *s* (same | (5) |
-| | as "del s[:]") | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.copy()" | creates a shallow copy of *s* | (5) |
-| | (same as "s[:]") | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.extend(t)" or "s += t" | extends *s* with the contents of | |
+| "s += t" | extends *s* with the contents of | |
| | *t* (for the most part the same | |
| | as "s[len(s):len(s)] = t") | |
+--------------------------------+----------------------------------+-----------------------+
-| "s *= n" | updates *s* with its contents | (6) |
+| "s *= n" | updates *s* with its contents | (2) |
| | repeated *n* times | |
+--------------------------------+----------------------------------+-----------------------+
-| "s.insert(i, x)" | inserts *x* into *s* at the | |
-| | index given by *i* (same as | |
-| | "s[i:i] = [x]") | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.pop()" or "s.pop(i)" | retrieves the item at *i* and | (2) |
-| | also removes it from *s* | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.remove(x)" | removes the first item from *s* | (3) |
-| | where "s[i]" is equal to *x* | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.reverse()" | reverses the items of *s* in | (4) |
-| | place | |
-+--------------------------------+----------------------------------+-----------------------+
Notes:
1. If *k* is not equal to "1", *t* must have the same length as the
slice it is replacing.
-2. The optional argument *i* defaults to "-1", so that by default the
- last item is removed and returned.
+2. The value *n* is an integer, or an object implementing
+ "__index__()". Zero and negative values of *n* clear the sequence.
+ Items in the sequence are not copied; they are referenced multiple
+ times, as explained for "s * n" under Common Sequence Operations.
-3. "remove()" raises "ValueError" when *x* is not found in *s*.
+-[ Mutable Sequence Methods ]-
-4. The "reverse()" method modifies the sequence in place for economy
- of space when reversing a large sequence. To remind users that it
- operates by side effect, it does not return the reversed sequence.
+Mutable sequence types also support the following methods:
-5. "clear()" and "copy()" are included for consistency with the
- interfaces of mutable containers that don’t support slicing
- operations (such as "dict" and "set"). "copy()" is not part of the
- "collections.abc.MutableSequence" ABC, but most concrete mutable
- sequence classes provide it.
+sequence.append(value, /)
- Added in version 3.3: "clear()" and "copy()" methods.
+ Append *value* to the end of the sequence This is equivalent to
+ writing "seq[len(seq):len(seq)] = [value]".
-6. The value *n* is an integer, or an object implementing
- "__index__()". Zero and negative values of *n* clear the sequence.
- Items in the sequence are not copied; they are referenced multiple
- times, as explained for "s * n" under Common Sequence Operations.
+sequence.clear()
+
+ Added in version 3.3.
+
+ Remove all items from *sequence*. This is equivalent to writing
+ "del sequence[:]".
+
+sequence.copy()
+
+ Added in version 3.3.
+
+ Create a shallow copy of *sequence*. This is equivalent to writing
+ "sequence[:]".
+
+ Hint:
+
+ The "copy()" method is not part of the "MutableSequence" "ABC",
+ but most concrete mutable sequence types provide it.
+
+sequence.extend(iterable, /)
+
+ Extend *sequence* with the contents of *iterable*. For the most
+ part, this is the same as writing "seq[len(seq):len(seq)] =
+ iterable".
+
+sequence.insert(index, value, /)
+
+ Insert *value* into *sequence* at the given *index*. This is
+ equivalent to writing "sequence[index:index] = [value]".
+
+sequence.pop(index=-1, /)
+
+ Retrieve the item at *index* and also removes it from *sequence*.
+ By default, the last item in *sequence* is removed and returned.
+
+sequence.remove(value, /)
+
+ Remove the first item from *sequence* where "sequence[i] == value".
+
+ Raises "ValueError" if *value* is not found in *sequence*.
+
+sequence.reverse()
+
+ Reverse the items of *sequence* in place. This method maintains
+ economy of space when reversing a large sequence. To remind users
+ that it operates by side-effect, it returns "None".
Lists
homogeneous items (where the precise degree of similarity will vary by
application).
-class list([iterable])
+class list(iterable=(), /)
Lists may be constructed in several ways:
of homogeneous data is needed (such as allowing storage in a "set" or
"dict" instance).
-class tuple([iterable])
+class tuple(iterable=(), /)
Tuples may be constructed in a number of ways:
The "range" type represents an immutable sequence of numbers and is
commonly used for looping a specific number of times in "for" loops.
-class range(stop)
-class range(start, stop[, step])
+class range(stop, /)
+class range(start, stop, step=1, /)
The arguments to the range constructor must be integers (either
built-in "int" or any object that implements the "__index__()"
| "del s[i:j:k]" | removes the elements of | |
| | "s[i:j:k]" from the list | |
+--------------------------------+----------------------------------+-----------------------+
-| "s.append(x)" | appends *x* to the end of the | |
-| | sequence (same as | |
-| | "s[len(s):len(s)] = [x]") | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.clear()" | removes all items from *s* (same | (5) |
-| | as "del s[:]") | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.copy()" | creates a shallow copy of *s* | (5) |
-| | (same as "s[:]") | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.extend(t)" or "s += t" | extends *s* with the contents of | |
+| "s += t" | extends *s* with the contents of | |
| | *t* (for the most part the same | |
| | as "s[len(s):len(s)] = t") | |
+--------------------------------+----------------------------------+-----------------------+
-| "s *= n" | updates *s* with its contents | (6) |
+| "s *= n" | updates *s* with its contents | (2) |
| | repeated *n* times | |
+--------------------------------+----------------------------------+-----------------------+
-| "s.insert(i, x)" | inserts *x* into *s* at the | |
-| | index given by *i* (same as | |
-| | "s[i:i] = [x]") | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.pop()" or "s.pop(i)" | retrieves the item at *i* and | (2) |
-| | also removes it from *s* | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.remove(x)" | removes the first item from *s* | (3) |
-| | where "s[i]" is equal to *x* | |
-+--------------------------------+----------------------------------+-----------------------+
-| "s.reverse()" | reverses the items of *s* in | (4) |
-| | place | |
-+--------------------------------+----------------------------------+-----------------------+
Notes:
1. If *k* is not equal to "1", *t* must have the same length as the
slice it is replacing.
-2. The optional argument *i* defaults to "-1", so that by default the
- last item is removed and returned.
+2. The value *n* is an integer, or an object implementing
+ "__index__()". Zero and negative values of *n* clear the sequence.
+ Items in the sequence are not copied; they are referenced multiple
+ times, as explained for "s * n" under Common Sequence Operations.
-3. "remove()" raises "ValueError" when *x* is not found in *s*.
+-[ Mutable Sequence Methods ]-
-4. The "reverse()" method modifies the sequence in place for economy
- of space when reversing a large sequence. To remind users that it
- operates by side effect, it does not return the reversed sequence.
+Mutable sequence types also support the following methods:
-5. "clear()" and "copy()" are included for consistency with the
- interfaces of mutable containers that don’t support slicing
- operations (such as "dict" and "set"). "copy()" is not part of the
- "collections.abc.MutableSequence" ABC, but most concrete mutable
- sequence classes provide it.
+sequence.append(value, /)
- Added in version 3.3: "clear()" and "copy()" methods.
+ Append *value* to the end of the sequence This is equivalent to
+ writing "seq[len(seq):len(seq)] = [value]".
-6. The value *n* is an integer, or an object implementing
- "__index__()". Zero and negative values of *n* clear the sequence.
- Items in the sequence are not copied; they are referenced multiple
- times, as explained for "s * n" under Common Sequence Operations.
+sequence.clear()
+
+ Added in version 3.3.
+
+ Remove all items from *sequence*. This is equivalent to writing
+ "del sequence[:]".
+
+sequence.copy()
+
+ Added in version 3.3.
+
+ Create a shallow copy of *sequence*. This is equivalent to writing
+ "sequence[:]".
+
+ Hint:
+
+ The "copy()" method is not part of the "MutableSequence" "ABC",
+ but most concrete mutable sequence types provide it.
+
+sequence.extend(iterable, /)
+
+ Extend *sequence* with the contents of *iterable*. For the most
+ part, this is the same as writing "seq[len(seq):len(seq)] =
+ iterable".
+
+sequence.insert(index, value, /)
+
+ Insert *value* into *sequence* at the given *index*. This is
+ equivalent to writing "sequence[index:index] = [value]".
+
+sequence.pop(index=-1, /)
+
+ Retrieve the item at *index* and also removes it from *sequence*.
+ By default, the last item in *sequence* is removed and returned.
+
+sequence.remove(value, /)
+
+ Remove the first item from *sequence* where "sequence[i] == value".
+
+ Raises "ValueError" if *value* is not found in *sequence*.
+
+sequence.reverse()
+
+ Reverse the items of *sequence* in place. This method maintains
+ economy of space when reversing a large sequence. To remind users
+ that it operates by side-effect, it returns "None".
''',
'unary': r'''Unary arithmetic and bitwise operations
***************************************
--- /dev/null
+.. date: 2025-10-06-23-56-36
+.. gh-issue: 124111
+.. nonce: KOlBvs
+.. release date: 2025-10-07
+.. section: macOS
+
+Update macOS installer to use Tcl/Tk 8.6.17.
+
+..
+
+.. date: 2025-10-04-12-29-31
+.. gh-issue: 139573
+.. nonce: vVpHaP
+.. section: macOS
+
+Updated bundled version of OpenSSL to 3.0.18.
+
+..
+
+.. date: 2025-10-04-12-18-45
+.. gh-issue: 139573
+.. nonce: EO9kVB
+.. section: Windows
+
+Updated bundled version of OpenSSL to 3.0.18.
+
+..
+
+.. date: 2025-09-15-15-34-29
+.. gh-issue: 138896
+.. nonce: lkiF_7
+.. section: Windows
+
+Fix error installing C runtime on non-updated Windows machines
+
+..
+
+.. date: 2025-09-25-10-31-02
+.. gh-issue: 139330
+.. nonce: 5WWkY0
+.. section: Tools/Demos
+
+SBOM generation tool didn't cross-check the version and checksum values
+against the ``Modules/expat/refresh.sh`` script, leading to the values
+becoming out-of-date during routine updates.
+
+..
+
+.. date: 2025-08-21-14-04-50
+.. gh-issue: 137873
+.. nonce: qxffLt
+.. section: Tools/Demos
+
+The iOS test runner has been simplified, resolving some issues that have
+been observed using the runner in GitHub Actions and Azure Pipelines test
+environments.
+
+..
+
+.. date: 2025-09-22-15-40-09
+.. gh-issue: 139208
+.. nonce: Tc13dl
+.. section: Tests
+
+Fix regrtest ``--fast-ci --verbose``: don't ignore the ``--verbose`` option
+anymore. Patch by Victor Stinner.
+
+..
+
+.. date: 2025-09-29-00-01-28
+.. gh-issue: 139400
+.. nonce: X2T-jO
+.. section: Security
+
+:mod:`xml.parsers.expat`: Make sure that parent Expat parsers are only
+garbage-collected once they are no longer referenced by subparsers created
+by :meth:`~xml.parsers.expat.xmlparser.ExternalEntityParserCreate`. Patch by
+Sebastian Pipping.
+
+..
+
+.. date: 2025-09-24-13-39-56
+.. gh-issue: 139283
+.. nonce: jODz_q
+.. section: Security
+
+:mod:`sqlite3`: correctly handle maximum number of rows to fetch in
+:meth:`Cursor.fetchmany <sqlite3.Cursor.fetchmany>` and reject negative
+values for :attr:`Cursor.arraysize <sqlite3.Cursor.arraysize>`. Patch by
+Bénédikt Tran.
+
+..
+
+.. date: 2025-06-18-13-34-55
+.. gh-issue: 135661
+.. nonce: NZlpWf
+.. section: Security
+
+Fix CDATA section parsing in :class:`html.parser.HTMLParser` according to
+the HTML5 standard: ``] ]>`` and ``]] >`` no longer end the CDATA section.
+Add private method ``_set_support_cdata()`` which can be used to specify how
+to parse ``<[CDATA[`` --- as a CDATA section in foreign content (SVG or
+MathML) or as a bogus comment in the HTML namespace.
+
+..
+
+.. date: 2025-09-25-07-33-43
+.. gh-issue: 139312
+.. nonce: ygE8AC
+.. section: Library
+
+Upgrade bundled libexpat to 2.7.3
+
+..
+
+.. date: 2025-09-24-14-17-34
+.. gh-issue: 139289
+.. nonce: Vmk25k
+.. section: Library
+
+Do a real lazy-import on :mod:`rlcompleter` in :mod:`pdb` and restore the
+existing completer after importing :mod:`rlcompleter`.
+
+..
+
+.. date: 2025-09-21-15-58-57
+.. gh-issue: 139210
+.. nonce: HGbMvz
+.. section: Library
+
+Fix use-after-free when reporting unknown event in
+:func:`xml.etree.ElementTree.iterparse`. Patch by Ken Jin.
+
+..
+
+.. date: 2025-09-20-17-50-31
+.. gh-issue: 138860
+.. nonce: Y9JXap
+.. section: Library
+
+Lazy import :mod:`rlcompleter` in :mod:`pdb` to avoid deadlock in
+subprocess.
+
+..
+
+.. date: 2025-09-19-09-36-42
+.. gh-issue: 112729
+.. nonce: mmty0_
+.. section: Library
+
+Fix crash when calling ``_interpreters.create`` when the process is out of
+memory.
+
+..
+
+.. date: 2025-09-17-21-54-53
+.. gh-issue: 139076
+.. nonce: 2eX9lG
+.. section: Library
+
+Fix a bug in the :mod:`pydoc` module that was hiding functions in a Python
+module if they were implemented in an extension module and the module did
+not have ``__all__``.
+
+..
+
+.. date: 2025-09-16-19-05-29
+.. gh-issue: 138998
+.. nonce: URl0Y_
+.. section: Library
+
+Update bundled libexpat to 2.7.2
+
+..
+
+.. date: 2025-09-15-19-29-12
+.. gh-issue: 130567
+.. nonce: shDEnT
+.. section: Library
+
+Fix possible crash in :func:`locale.strxfrm` due to a platform bug on macOS.
+
+..
+
+.. date: 2025-09-11-11-09-28
+.. gh-issue: 138779
+.. nonce: TNZnLr
+.. section: Library
+
+Support device numbers larger than ``2**63-1`` for the
+:attr:`~os.stat_result.st_rdev` field of the :class:`os.stat_result`
+structure.
+
+..
+
+.. date: 2025-09-10-10-02-59
+.. gh-issue: 128636
+.. nonce: ldRKGZ
+.. section: Library
+
+Fix crash in PyREPL when os.environ is overwritten with an invalid value for
+mac
+
+..
+
+.. date: 2025-09-05-15-35-59
+.. gh-issue: 88375
+.. nonce: dC491a
+.. section: Library
+
+Fix normalization of the ``robots.txt`` rules and URLs in the
+:mod:`urllib.robotparser` module. No longer ignore trailing ``?``.
+Distinguish raw special characters ``?``, ``=`` and ``&`` from the
+percent-encoded ones.
+
+..
+
+.. date: 2025-09-05-07-50-18
+.. gh-issue: 138515
+.. nonce: E3M-pu
+.. section: Library
+
+:mod:`email` is added to Emscripten build.
+
+..
+
+.. date: 2025-09-04-15-18-11
+.. gh-issue: 111788
+.. nonce: tuTEM5
+.. section: Library
+
+Fix parsing errors in the :mod:`urllib.robotparser` module. Don't fail
+trying to parse weird paths. Don't fail trying to decode non-UTF-8
+``robots.txt`` files.
+
+..
+
+.. date: 2025-09-03-15-20-10
+.. gh-issue: 138432
+.. nonce: RMc7UX
+.. section: Library
+
+:meth:`zoneinfo.reset_tzpath` will now convert any :class:`os.PathLike`
+objects it receives into strings before adding them to ``TZPATH``. It will
+raise ``TypeError`` if anything other than a string is found after this
+conversion. If given an :class:`os.PathLike` object that represents a
+relative path, it will now raise ``ValueError`` instead of ``TypeError``,
+and present a more informative error message.
+
+..
+
+.. date: 2025-08-31-09-06-49
+.. gh-issue: 138008
+.. nonce: heOvsU
+.. section: Library
+
+Fix segmentation faults in the :mod:`ctypes` module due to invalid
+:attr:`~ctypes._CFuncPtr.argtypes`. Patch by Dung Nguyen.
+
+..
+
+.. date: 2025-08-30-10-04-28
+.. gh-issue: 60462
+.. nonce: yh_vDc
+.. section: Library
+
+Fix :func:`locale.strxfrm` on Solaris (and possibly other platforms).
+
+..
+
+.. date: 2025-08-28-13-20-09
+.. gh-issue: 138204
+.. nonce: 8oLOud
+.. section: Library
+
+Forbid expansion of shared anonymous :mod:`memory maps <mmap>` on Linux,
+which caused a bus error.
+
+..
+
+.. date: 2025-08-27-17-05-36
+.. gh-issue: 138010
+.. nonce: ZZJmPL
+.. section: Library
+
+Fix an issue where defining a class with a
+:deco:`warnings.deprecated`-decorated base class may not invoke the correct
+:meth:`~object.__init_subclass__` method in cases involving multiple
+inheritance. Patch by Brian Schubert.
+
+..
+
+.. date: 2025-08-25-18-06-04
+.. gh-issue: 138133
+.. nonce: Zh9rGo
+.. section: Library
+
+Prevent infinite traceback loop when sending CTRL^C to Python through
+``strace``.
+
+..
+
+.. date: 2025-08-18-16-02-51
+.. gh-issue: 134869
+.. nonce: GnAjnU
+.. section: Library
+
+Fix an issue where pressing Ctrl+C during tab completion in the REPL would
+leave the autocompletion menu in a corrupted state.
+
+..
+
+.. date: 2025-08-16-16-04-15
+.. gh-issue: 137317
+.. nonce: Dl13B5
+.. section: Library
+
+:func:`inspect.signature` now correctly handles classes that use a
+descriptor on a wrapped :meth:`!__init__` or :meth:`!__new__` method.
+Contributed by Yongyu Yan.
+
+..
+
+.. date: 2025-08-16-09-02-11
+.. gh-issue: 137754
+.. nonce: mCev1Y
+.. section: Library
+
+Fix import of the :mod:`zoneinfo` module if the C implementation of the
+:mod:`datetime` module is not available.
+
+..
+
+.. date: 2025-08-07-17-18-57
+.. gh-issue: 137490
+.. nonce: s89ieZ
+.. section: Library
+
+Handle :data:`~errno.ECANCELED` in the same way as :data:`~errno.EINTR` in
+:func:`signal.sigwaitinfo` on NetBSD.
+
+..
+
+.. date: 2025-08-06-23-16-42
+.. gh-issue: 137477
+.. nonce: bk6BDV
+.. section: Library
+
+Fix :func:`!inspect.getblock`, :func:`inspect.getsourcelines` and
+:func:`inspect.getsource` for generator expressions.
+
+..
+
+.. date: 2025-08-01-23-11-25
+.. gh-issue: 137017
+.. nonce: 0yGcNc
+.. section: Library
+
+Fix :obj:`threading.Thread.is_alive` to remain ``True`` until the underlying
+OS thread is fully cleaned up. This avoids false negatives in edge cases
+involving thread monitoring or premature :obj:`threading.Thread.is_alive`
+calls.
+
+..
+
+.. date: 2025-07-13-13-31-22
+.. gh-issue: 136134
+.. nonce: mh6VjS
+.. section: Library
+
+:meth:`!SMTP.auth_cram_md5` now raises an :exc:`~smtplib.SMTPException`
+instead of a :exc:`ValueError` if Python has been built without MD5 support.
+In particular, :class:`~smtplib.SMTP` clients will not attempt to use this
+method even if the remote server is assumed to support it. Patch by Bénédikt
+Tran.
+
+..
+
+.. date: 2025-07-13-11-20-05
+.. gh-issue: 136134
+.. nonce: xhh0Kq
+.. section: Library
+
+:meth:`IMAP4.login_cram_md5 <imaplib.IMAP4.login_cram_md5>` now raises an
+:exc:`IMAP4.error <imaplib.IMAP4.error>` if CRAM-MD5 authentication is not
+supported. Patch by Bénédikt Tran.
+
+..
+
+.. date: 2025-06-16-15-00-13
+.. gh-issue: 135386
+.. nonce: lNrxLc
+.. section: Library
+
+Fix opening a :mod:`dbm.sqlite3` database for reading from read-only file or
+directory.
+
+..
+
+.. date: 2025-06-10-21-00-48
+.. gh-issue: 126631
+.. nonce: eITVJd
+.. section: Library
+
+Fix :mod:`multiprocessing` ``forkserver`` bug which prevented ``__main__``
+from being preloaded.
+
+..
+
+.. date: 2024-08-17-08-17-20
+.. gh-issue: 123085
+.. nonce: 7Io2yH
+.. section: Library
+
+In a bare call to :func:`importlib.resources.files`, ensure the caller's
+frame is properly detected when ``importlib.resources`` is itself available
+as a compiled module only (no source).
+
+..
+
+.. date: 2024-05-13-09-50-31
+.. gh-issue: 118981
+.. nonce: zgOQPv
+.. section: Library
+
+Fix potential hang in ``multiprocessing.popen_spawn_posix`` that can happen
+when the child proc dies early by closing the child fds right away.
+
+..
+
+.. date: 2023-02-13-20-34-52
+.. gh-issue: 78319
+.. nonce: V1zzed
+.. section: Library
+
+UTF8 support for the IMAP APPEND command has been made RFC compliant.
+
+..
+
+.. bpo: 38735
+.. date: 2022-01-07-16-56-57
+.. nonce: NFfJX6
+.. section: Library
+
+Fix failure when importing a module from the root directory on unix-like
+platforms with sys.pycache_prefix set.
+
+..
+
+.. bpo: 41839
+.. date: 2020-09-23-11-54-17
+.. nonce: kU5Ywl
+.. section: Library
+
+Allow negative priority values from :func:`os.sched_get_priority_min` and
+:func:`os.sched_get_priority_max` functions.
+
+..
+
+.. date: 2025-09-15-14-04-56
+.. gh-issue: 134466
+.. nonce: yR4fYW
+.. section: Core and Builtins
+
+Don't run PyREPL in a degraded environment where setting termios attributes
+is not allowed.
+
+..
+
+.. date: 2025-09-10-14-53-59
+.. gh-issue: 71810
+.. nonce: ppf0J-
+.. section: Core and Builtins
+
+Raise :exc:`OverflowError` for ``(-1).to_bytes()`` for signed conversions
+when bytes count is zero. Patch by Sergey B Kirpichev.
+
+..
+
+.. date: 2025-09-06-13-53-33
+.. gh-issue: 105487
+.. nonce: a43YaY
+.. section: Core and Builtins
+
+Remove non-existent :meth:`~object.__copy__`, :meth:`~object.__deepcopy__`,
+and :attr:`~type.__bases__` from the :meth:`~object.__dir__` entries of
+:class:`types.GenericAlias`.
+
+..
+
+.. date: 2025-09-04-11-52-23
+.. gh-issue: 134163
+.. nonce: EqKyn8
+.. section: Core and Builtins
+
+Fix a hang when the process is out of memory inside an exception handler.
+
+..
+
+.. date: 2025-09-03-17-00-30
+.. gh-issue: 138479
+.. nonce: qUxgWs
+.. section: Core and Builtins
+
+Fix a crash when a generic object's ``__typing_subst__`` returns an object
+that isn't a :class:`tuple`.
+
+..
+
+.. date: 2025-08-10-21-34-12
+.. gh-issue: 137576
+.. nonce: 0ZicS-
+.. section: Core and Builtins
+
+Fix for incorrect source code being shown in tracebacks from the Basic REPL
+when :envvar:`PYTHONSTARTUP` is given. Patch by Adam Hartz.
+
+..
+
+.. date: 2025-04-20-10-37-39
+.. gh-issue: 132744
+.. nonce: ArrCp8
+.. section: Core and Builtins
+
+Certain calls now check for runaway recursion and respect the system
+recursion limit.
+
+..
+
+.. date: 2022-08-05-19-41-20
+.. gh-issue: 87135
+.. nonce: SCNBYj
+.. section: C API
+
+Attempting to acquire the GIL after runtime finalization has begun in a
+different thread now causes the thread to hang rather than terminate, which
+avoids potential crashes or memory corruption caused by attempting to
+terminate a thread that is running code not specifically designed to support
+termination. In most cases this hanging is harmless since the process will
+soon exit anyway.
+
+While not officially marked deprecated until 3.14, ``PyThread_exit_thread``
+is no longer called internally and remains solely for interface
+compatibility. Its behavior is inconsistent across platforms, and it can
+only be used safely in the unlikely case that every function in the entire
+call stack has been designed to support the platform-dependent termination
+mechanism. It is recommended that users of this function change their
+design to not require thread termination. In the unlikely case that thread
+termination is needed and can be done safely, users may migrate to calling
+platform-specific APIs such as ``pthread_exit`` (POSIX) or ``_endthreadex``
+(Windows) directly.
+
+..
+
+.. date: 2025-08-20-16-45-34
+.. gh-issue: 135734
+.. nonce: 2hvJCe
+.. section: Build
+
+Python can correctly be configured and built with ``./configure
+--enable-optimizations --disable-test-modules``. Previously, the profile
+data generation step failed due to PGO tests where immortalization couldn't
+be properly suppressed. Patch by Bénédikt Tran.