mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Python 3.14.0b3
This commit is contained in:
parent
c1735c5b4e
commit
26d485d122
62 changed files with 631 additions and 146 deletions
|
@ -1,4 +1,4 @@
|
|||
# Autogenerated by Sphinx on Mon May 26 16:26:41 2025
|
||||
# Autogenerated by Sphinx on Tue Jun 17 18:40:47 2025
|
||||
# as part of the release process.
|
||||
|
||||
topics = {
|
||||
|
@ -5327,7 +5327,7 @@ The general form of a *standard format specifier* is:
|
|||
sign: "+" | "-" | " "
|
||||
width_and_precision: [width_with_grouping][precision_with_grouping]
|
||||
width_with_grouping: [width][grouping]
|
||||
precision_with_grouping: "." [precision][grouping]
|
||||
precision_with_grouping: "." [precision][grouping] | "." grouping
|
||||
width: digit+
|
||||
precision: digit+
|
||||
grouping: "," | "_"
|
||||
|
@ -9303,7 +9303,13 @@ str.encode(encoding='utf-8', errors='strict')
|
|||
|
||||
For performance reasons, the value of *errors* is not checked for
|
||||
validity unless an encoding error actually occurs, Python
|
||||
Development Mode is enabled or a debug build is used.
|
||||
Development Mode is enabled or a debug build is used. For example:
|
||||
|
||||
>>> encoded_str_to_bytes = 'Python'.encode()
|
||||
>>> type(encoded_str_to_bytes)
|
||||
<class 'bytes'>
|
||||
>>> encoded_str_to_bytes
|
||||
b'Python'
|
||||
|
||||
Changed in version 3.1: Added support for keyword arguments.
|
||||
|
||||
|
@ -9316,6 +9322,19 @@ str.endswith(suffix[, start[, end]])
|
|||
otherwise return "False". *suffix* can also be a tuple of suffixes
|
||||
to look for. With optional *start*, test beginning at that
|
||||
position. With optional *end*, stop comparing at that position.
|
||||
Using *start* and *end* is equivalent to
|
||||
"str[start:end].endswith(suffix)". For example:
|
||||
|
||||
>>> 'Python'.endswith('on')
|
||||
True
|
||||
>>> 'a tuple of suffixes'.endswith(('at', 'in'))
|
||||
False
|
||||
>>> 'a tuple of suffixes'.endswith(('at', 'es'))
|
||||
True
|
||||
>>> 'Python is amazing'.endswith('is', 0, 9)
|
||||
True
|
||||
|
||||
See also "startswith()" and "removesuffix()".
|
||||
|
||||
str.expandtabs(tabsize=8)
|
||||
|
||||
|
@ -9331,12 +9350,15 @@ str.expandtabs(tabsize=8)
|
|||
("\n") or return ("\r"), it is copied and the current column is
|
||||
reset to zero. Any other character is copied unchanged and the
|
||||
current column is incremented by one regardless of how the
|
||||
character is represented when printed.
|
||||
character is represented when printed. For example:
|
||||
|
||||
>>> '01\t012\t0123\t01234'.expandtabs()
|
||||
'01 012 0123 01234'
|
||||
>>> '01\t012\t0123\t01234'.expandtabs(4)
|
||||
'01 012 0123 01234'
|
||||
>>> '01\t012\t0123\t01234'.expandtabs()
|
||||
'01 012 0123 01234'
|
||||
>>> '01\t012\t0123\t01234'.expandtabs(4)
|
||||
'01 012 0123 01234'
|
||||
>>> print('01\t012\n0123\t01234'.expandtabs(4))
|
||||
01 012
|
||||
0123 01234
|
||||
|
||||
str.find(sub[, start[, end]])
|
||||
|
||||
|
@ -9924,8 +9946,9 @@ str.zfill(width)
|
|||
String literals are described by the following lexical definitions:
|
||||
|
||||
stringliteral: [stringprefix](shortstring | longstring)
|
||||
stringprefix: "r" | "u" | "R" | "U" | "f" | "F"
|
||||
stringprefix: "r" | "u" | "R" | "U" | "f" | "F" | "t" | "T"
|
||||
| "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" | "RF"
|
||||
| "tr" | "Tr" | "tR" | "TR" | "rt" | "rT" | "Rt" | "RT"
|
||||
shortstring: "'" shortstringitem* "'" | '"' shortstringitem* '"'
|
||||
longstring: "\'\'\'" longstringitem* "\'\'\'" | '"""' longstringitem* '"""'
|
||||
shortstringitem: shortstringchar | stringescapeseq
|
||||
|
@ -11242,11 +11265,20 @@ Special attributes
|
|||
| | collected during class body execution. See also: |
|
||||
| | "__annotations__ attributes". For best practices |
|
||||
| | on working with "__annotations__", please see |
|
||||
| | "annotationlib". Where possible, use |
|
||||
| | "annotationlib". Use |
|
||||
| | "annotationlib.get_annotations()" instead of |
|
||||
| | accessing this attribute directly. Changed in |
|
||||
| | version 3.14: Annotations are now lazily |
|
||||
| | evaluated. See **PEP 649**. |
|
||||
| | accessing this attribute directly. Warning: |
|
||||
| | Accessing the "__annotations__" attribute directly |
|
||||
| | on a class object may return annotations for the |
|
||||
| | wrong class, specifically in certain cases where |
|
||||
| | the class, its base class, or a metaclass is |
|
||||
| | defined under "from __future__ import |
|
||||
| | annotations". See **749** for details.This |
|
||||
| | attribute does not exist on certain builtin |
|
||||
| | classes. On user-defined classes without |
|
||||
| | "__annotations__", it is an empty dictionary. |
|
||||
| | Changed in version 3.14: Annotations are now |
|
||||
| | lazily evaluated. See **PEP 649**. |
|
||||
+----------------------------------------------------+----------------------------------------------------+
|
||||
| type.__annotate__() | The *annotate function* for this class, or "None" |
|
||||
| | if the class has no annotations. See also: |
|
||||
|
@ -12240,7 +12272,7 @@ operations. [3]
|
|||
| "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) |
|
||||
| "s[i]" | *i*th item of *s*, origin 0 | (3)(9) |
|
||||
+----------------------------+----------------------------------+------------+
|
||||
| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |
|
||||
+----------------------------+----------------------------------+------------+
|
||||
|
@ -12364,6 +12396,8 @@ Notes:
|
|||
returned index being relative to the start of the sequence rather
|
||||
than the start of the slice.
|
||||
|
||||
9. An "IndexError" is raised if *i* is outside the sequence range.
|
||||
|
||||
|
||||
Immutable Sequence Types
|
||||
========================
|
||||
|
@ -12398,6 +12432,8 @@ accepts integers that meet the value restriction "0 <= x <= 255").
|
|||
| "s[i] = x" | item *i* of *s* is replaced by | |
|
||||
| | *x* | |
|
||||
+--------------------------------+----------------------------------+-----------------------+
|
||||
| "del s[i]" | removes item *i* of *s* | |
|
||||
+--------------------------------+----------------------------------+-----------------------+
|
||||
| "s[i:j] = t" | slice of *s* from *i* to *j* is | |
|
||||
| | replaced by the contents of the | |
|
||||
| | iterable *t* | |
|
||||
|
@ -12726,6 +12762,8 @@ accepts integers that meet the value restriction "0 <= x <= 255").
|
|||
| "s[i] = x" | item *i* of *s* is replaced by | |
|
||||
| | *x* | |
|
||||
+--------------------------------+----------------------------------+-----------------------+
|
||||
| "del s[i]" | removes item *i* of *s* | |
|
||||
+--------------------------------+----------------------------------+-----------------------+
|
||||
| "s[i:j] = t" | slice of *s* from *i* to *j* is | |
|
||||
| | replaced by the contents of the | |
|
||||
| | iterable *t* | |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue