1
- # Autogenerated by Sphinx on Mon May 26 16:26:41 2025
1
+ # Autogenerated by Sphinx on Tue Jun 17 18:40:47 2025
2
2
# as part of the release process.
3
3
4
4
topics = {
@@ -5327,7 +5327,7 @@ class of the instance or a *non-virtual base class* thereof. The
5327
5327
sign: "+" | "-" | " "
5328
5328
width_and_precision: [width_with_grouping][precision_with_grouping]
5329
5329
width_with_grouping: [width][grouping]
5330
- precision_with_grouping: "." [precision][grouping]
5330
+ precision_with_grouping: "." [precision][grouping] | "." grouping
5331
5331
width: digit+
5332
5332
precision: digit+
5333
5333
grouping: "," | "_"
@@ -9303,7 +9303,13 @@ class is used in a class pattern with positional arguments, each
9303
9303
9304
9304
For performance reasons, the value of *errors* is not checked for
9305
9305
validity unless an encoding error actually occurs, Python
9306
- Development Mode is enabled or a debug build is used.
9306
+ Development Mode is enabled or a debug build is used. For example:
9307
+
9308
+ >>> encoded_str_to_bytes = 'Python'.encode()
9309
+ >>> type(encoded_str_to_bytes)
9310
+ <class 'bytes'>
9311
+ >>> encoded_str_to_bytes
9312
+ b'Python'
9307
9313
9308
9314
Changed in version 3.1: Added support for keyword arguments.
9309
9315
@@ -9316,6 +9322,19 @@ class is used in a class pattern with positional arguments, each
9316
9322
otherwise return "False". *suffix* can also be a tuple of suffixes
9317
9323
to look for. With optional *start*, test beginning at that
9318
9324
position. With optional *end*, stop comparing at that position.
9325
+ Using *start* and *end* is equivalent to
9326
+ "str[start:end].endswith(suffix)". For example:
9327
+
9328
+ >>> 'Python'.endswith('on')
9329
+ True
9330
+ >>> 'a tuple of suffixes'.endswith(('at', 'in'))
9331
+ False
9332
+ >>> 'a tuple of suffixes'.endswith(('at', 'es'))
9333
+ True
9334
+ >>> 'Python is amazing'.endswith('is', 0, 9)
9335
+ True
9336
+
9337
+ See also "startswith()" and "removesuffix()".
9319
9338
9320
9339
str.expandtabs(tabsize=8)
9321
9340
@@ -9331,12 +9350,15 @@ class is used in a class pattern with positional arguments, each
9331
9350
("\n") or return ("\r"), it is copied and the current column is
9332
9351
reset to zero. Any other character is copied unchanged and the
9333
9352
current column is incremented by one regardless of how the
9334
- character is represented when printed.
9353
+ character is represented when printed. For example:
9335
9354
9336
- >>> '01\t012\t0123\t01234'.expandtabs()
9337
- '01 012 0123 01234'
9338
- >>> '01\t012\t0123\t01234'.expandtabs(4)
9339
- '01 012 0123 01234'
9355
+ >>> '01\t012\t0123\t01234'.expandtabs()
9356
+ '01 012 0123 01234'
9357
+ >>> '01\t012\t0123\t01234'.expandtabs(4)
9358
+ '01 012 0123 01234'
9359
+ >>> print('01\t012\n0123\t01234'.expandtabs(4))
9360
+ 01 012
9361
+ 0123 01234
9340
9362
9341
9363
str.find(sub[, start[, end]])
9342
9364
@@ -9924,8 +9946,9 @@ class is used in a class pattern with positional arguments, each
9924
9946
String literals are described by the following lexical definitions:
9925
9947
9926
9948
stringliteral: [stringprefix](shortstring | longstring)
9927
- stringprefix: "r" | "u" | "R" | "U" | "f" | "F"
9949
+ stringprefix: "r" | "u" | "R" | "U" | "f" | "F" | "t" | "T"
9928
9950
| "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" | "RF"
9951
+ | "tr" | "Tr" | "tR" | "TR" | "rt" | "rT" | "Rt" | "RT"
9929
9952
shortstring: "'" shortstringitem* "'" | '"' shortstringitem* '"'
9930
9953
longstring: "\'\'\'" longstringitem* "\'\'\'" | '"""' longstringitem* '"""'
9931
9954
shortstringitem: shortstringchar | stringescapeseq
@@ -11242,11 +11265,20 @@ class method object, it is transformed into an instance method object
11242
11265
| | collected during class body execution. See also: |
11243
11266
| | "__annotations__ attributes". For best practices |
11244
11267
| | on working with "__annotations__", please see |
11245
- | | "annotationlib". Where possible, use |
11268
+ | | "annotationlib". Use |
11246
11269
| | "annotationlib.get_annotations()" instead of |
11247
- | | accessing this attribute directly. Changed in |
11248
- | | version 3.14: Annotations are now lazily |
11249
- | | evaluated. See **PEP 649**. |
11270
+ | | accessing this attribute directly. Warning: |
11271
+ | | Accessing the "__annotations__" attribute directly |
11272
+ | | on a class object may return annotations for the |
11273
+ | | wrong class, specifically in certain cases where |
11274
+ | | the class, its base class, or a metaclass is |
11275
+ | | defined under "from __future__ import |
11276
+ | | annotations". See **749** for details.This |
11277
+ | | attribute does not exist on certain builtin |
11278
+ | | classes. On user-defined classes without |
11279
+ | | "__annotations__", it is an empty dictionary. |
11280
+ | | Changed in version 3.14: Annotations are now |
11281
+ | | lazily evaluated. See **PEP 649**. |
11250
11282
+----------------------------------------------------+----------------------------------------------------+
11251
11283
| type.__annotate__() | The *annotate function* for this class, or "None" |
11252
11284
| | if the class has no annotations. See also: |
@@ -12240,7 +12272,7 @@ class dict(iterable, **kwargs)
12240
12272
| "s * n" or "n * s" | equivalent to adding *s* to | (2)(7) |
12241
12273
| | itself *n* times | |
12242
12274
+----------------------------+----------------------------------+------------+
12243
- | "s[i]" | *i*th item of *s*, origin 0 | (3) |
12275
+ | "s[i]" | *i*th item of *s*, origin 0 | (3)(9) |
12244
12276
+----------------------------+----------------------------------+------------+
12245
12277
| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |
12246
12278
+----------------------------+----------------------------------+------------+
@@ -12364,6 +12396,8 @@ class dict(iterable, **kwargs)
12364
12396
returned index being relative to the start of the sequence rather
12365
12397
than the start of the slice.
12366
12398
12399
+ 9. An "IndexError" is raised if *i* is outside the sequence range.
12400
+
12367
12401
12368
12402
Immutable Sequence Types
12369
12403
========================
@@ -12398,6 +12432,8 @@ class dict(iterable, **kwargs)
12398
12432
| "s[i] = x" | item *i* of *s* is replaced by | |
12399
12433
| | *x* | |
12400
12434
+--------------------------------+----------------------------------+-----------------------+
12435
+ | "del s[i]" | removes item *i* of *s* | |
12436
+ +--------------------------------+----------------------------------+-----------------------+
12401
12437
| "s[i:j] = t" | slice of *s* from *i* to *j* is | |
12402
12438
| | replaced by the contents of the | |
12403
12439
| | iterable *t* | |
@@ -12726,6 +12762,8 @@ class range(start, stop[, step])
12726
12762
| "s[i] = x" | item *i* of *s* is replaced by | |
12727
12763
| | *x* | |
12728
12764
+--------------------------------+----------------------------------+-----------------------+
12765
+ | "del s[i]" | removes item *i* of *s* | |
12766
+ +--------------------------------+----------------------------------+-----------------------+
12729
12767
| "s[i:j] = t" | slice of *s* from *i* to *j* is | |
12730
12768
| | replaced by the contents of the | |
12731
12769
| | iterable *t* | |
0 commit comments