mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Python 3.13.3
This commit is contained in:
parent
67c7de49dc
commit
6280bb5478
108 changed files with 1119 additions and 240 deletions
|
@ -1,4 +1,4 @@
|
|||
# Autogenerated by Sphinx on Sat Feb 22 02:02:02 2025
|
||||
# Autogenerated by Sphinx on Tue Apr 8 15:54:03 2025
|
||||
# as part of the release process.
|
||||
|
||||
topics = {
|
||||
|
@ -2689,7 +2689,7 @@ section The standard type hierarchy):
|
|||
parameter_list_no_posonly ::= defparameter ("," defparameter)* ["," [parameter_list_starargs]]
|
||||
| parameter_list_starargs
|
||||
parameter_list_starargs ::= "*" [star_parameter] ("," defparameter)* ["," [parameter_star_kwargs]]
|
||||
"*" ("," defparameter)+ ["," [parameter_star_kwargs]]
|
||||
| "*" ("," defparameter)+ ["," [parameter_star_kwargs]]
|
||||
| parameter_star_kwargs
|
||||
parameter_star_kwargs ::= "**" parameter [","]
|
||||
parameter ::= identifier [":" expression]
|
||||
|
@ -3787,7 +3787,7 @@ and local names are offered as arguments of the "p" command.
|
|||
You can also invoke "pdb" from the command line to debug other
|
||||
scripts. For example:
|
||||
|
||||
python -m pdb myscript.py
|
||||
python -m pdb [-c command] (-m module | pyfile) [args ...]
|
||||
|
||||
When invoked as a module, pdb will automatically enter post-mortem
|
||||
debugging if the program being debugged exits abnormally. After post-
|
||||
|
@ -3796,12 +3796,20 @@ restart the program. Automatic restarting preserves pdb’s state (such
|
|||
as breakpoints) and in most cases is more useful than quitting the
|
||||
debugger upon program’s exit.
|
||||
|
||||
Changed in version 3.2: Added the "-c" option to execute commands as
|
||||
if given in a ".pdbrc" file; see Debugger Commands.
|
||||
-c, --command <command>
|
||||
|
||||
Changed in version 3.7: Added the "-m" option to execute modules
|
||||
similar to the way "python -m" does. As with a script, the debugger
|
||||
will pause execution just before the first line of the module.
|
||||
To execute commands as if given in a ".pdbrc" file; see Debugger
|
||||
Commands.
|
||||
|
||||
Changed in version 3.2: Added the "-c" option.
|
||||
|
||||
-m <module>
|
||||
|
||||
To execute modules similar to the way "python -m" does. As with a
|
||||
script, the debugger will pause execution just before the first
|
||||
line of the module.
|
||||
|
||||
Changed in version 3.7: Added the "-m" option.
|
||||
|
||||
Typical usage to execute a statement under control of the debugger is:
|
||||
|
||||
|
@ -5153,14 +5161,16 @@ format specification typically modifies the result.
|
|||
|
||||
The general form of a *standard format specifier* is:
|
||||
|
||||
format_spec ::= [[fill]align][sign]["z"]["#"]["0"][width][grouping_option]["." precision][type]
|
||||
fill ::= <any character>
|
||||
align ::= "<" | ">" | "=" | "^"
|
||||
sign ::= "+" | "-" | " "
|
||||
width ::= digit+
|
||||
grouping_option ::= "_" | ","
|
||||
precision ::= digit+
|
||||
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
|
||||
format_spec ::= [options][width][grouping]["." precision][type]
|
||||
options ::= [[fill]align][sign]["z"]["#"]["0"]
|
||||
fill ::= <any character>
|
||||
align ::= "<" | ">" | "=" | "^"
|
||||
sign ::= "+" | "-" | " "
|
||||
width ::= digit+
|
||||
grouping ::= "," | "_"
|
||||
precision ::= digit+
|
||||
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g"
|
||||
| "G" | "n" | "o" | "s" | "x" | "X" | "%"
|
||||
|
||||
If a valid *align* value is specified, it can be preceded by a *fill*
|
||||
character that can be any character and defaults to a space if
|
||||
|
@ -5202,13 +5212,13 @@ the following:
|
|||
+-----------+------------------------------------------------------------+
|
||||
| Option | Meaning |
|
||||
|===========|============================================================|
|
||||
| "'+'" | indicates that a sign should be used for both positive as |
|
||||
| "'+'" | Indicates that a sign should be used for both positive as |
|
||||
| | well as negative numbers. |
|
||||
+-----------+------------------------------------------------------------+
|
||||
| "'-'" | indicates that a sign should be used only for negative |
|
||||
| "'-'" | Indicates that a sign should be used only for negative |
|
||||
| | numbers (this is the default behavior). |
|
||||
+-----------+------------------------------------------------------------+
|
||||
| space | indicates that a leading space should be used on positive |
|
||||
| space | Indicates that a leading space should be used on positive |
|
||||
| | numbers, and a minus sign on negative numbers. |
|
||||
+-----------+------------------------------------------------------------+
|
||||
|
||||
|
@ -5231,26 +5241,10 @@ point character appears in the result of these conversions only if a
|
|||
digit follows it. In addition, for "'g'" and "'G'" conversions,
|
||||
trailing zeros are not removed from the result.
|
||||
|
||||
The "','" option signals the use of a comma for a thousands separator
|
||||
for floating-point presentation types and for integer presentation
|
||||
type "'d'". For other presentation types, this option is an error. For
|
||||
a locale aware separator, use the "'n'" integer presentation type
|
||||
instead.
|
||||
|
||||
Changed in version 3.1: Added the "','" option (see also **PEP 378**).
|
||||
|
||||
The "'_'" option signals the use of an underscore for a thousands
|
||||
separator for floating-point presentation types and for integer
|
||||
presentation type "'d'". For integer presentation types "'b'", "'o'",
|
||||
"'x'", and "'X'", underscores will be inserted every 4 digits. For
|
||||
other presentation types, specifying this option is an error.
|
||||
|
||||
Changed in version 3.6: Added the "'_'" option (see also **PEP 515**).
|
||||
|
||||
*width* is a decimal integer defining the minimum total field width,
|
||||
including any prefixes, separators, and other formatting characters.
|
||||
If not specified, then the field width will be determined by the
|
||||
content.
|
||||
The *width* is a decimal integer defining the minimum total field
|
||||
width, including any prefixes, separators, and other formatting
|
||||
characters. If not specified, then the field width will be determined
|
||||
by the content.
|
||||
|
||||
When no explicit alignment is given, preceding the *width* field by a
|
||||
zero ("'0'") character enables sign-aware zero-padding for numeric
|
||||
|
@ -5260,6 +5254,32 @@ of "'0'" with an *alignment* type of "'='".
|
|||
Changed in version 3.10: Preceding the *width* field by "'0'" no
|
||||
longer affects the default alignment for strings.
|
||||
|
||||
The *grouping* option after the *width* field specifies a digit group
|
||||
separator for the integral part of a number. It can be one of the
|
||||
following:
|
||||
|
||||
+-----------+------------------------------------------------------------+
|
||||
| Option | Meaning |
|
||||
|===========|============================================================|
|
||||
| "','" | Inserts a comma every 3 digits for integer presentation |
|
||||
| | type "'d'" and floating-point presentation types, |
|
||||
| | excluding "'n'". For other presentation types, this option |
|
||||
| | is not supported. |
|
||||
+-----------+------------------------------------------------------------+
|
||||
| "'_'" | Inserts an underscore every 3 digits for integer |
|
||||
| | presentation type "'d'" and floating-point presentation |
|
||||
| | types, excluding "'n'". For integer presentation types |
|
||||
| | "'b'", "'o'", "'x'", and "'X'", underscores are inserted |
|
||||
| | every 4 digits. For other presentation types, this option |
|
||||
| | is not supported. |
|
||||
+-----------+------------------------------------------------------------+
|
||||
|
||||
For a locale aware separator, use the "'n'" presentation type instead.
|
||||
|
||||
Changed in version 3.1: Added the "','" option (see also **PEP 378**).
|
||||
|
||||
Changed in version 3.6: Added the "'_'" option (see also **PEP 515**).
|
||||
|
||||
The *precision* is a decimal integer indicating how many digits should
|
||||
be displayed after the decimal point for presentation types "'f'" and
|
||||
"'F'", or before and after the decimal point for presentation types
|
||||
|
@ -5304,8 +5324,8 @@ The available integer presentation types are:
|
|||
| | as well. |
|
||||
+-----------+------------------------------------------------------------+
|
||||
| "'n'" | Number. This is the same as "'d'", except that it uses the |
|
||||
| | current locale setting to insert the appropriate number |
|
||||
| | separator characters. |
|
||||
| | current locale setting to insert the appropriate digit |
|
||||
| | group separators. |
|
||||
+-----------+------------------------------------------------------------+
|
||||
| None | The same as "'d'". |
|
||||
+-----------+------------------------------------------------------------+
|
||||
|
@ -5376,8 +5396,8 @@ The available presentation types for "float" and "Decimal" values are:
|
|||
| | and NaN are uppercased, too. |
|
||||
+-----------+------------------------------------------------------------+
|
||||
| "'n'" | Number. This is the same as "'g'", except that it uses the |
|
||||
| | current locale setting to insert the appropriate number |
|
||||
| | separator characters. |
|
||||
| | current locale setting to insert the appropriate digit |
|
||||
| | group separators for the integral part of a number. |
|
||||
+-----------+------------------------------------------------------------+
|
||||
| "'%'" | Percentage. Multiplies the number by 100 and displays in |
|
||||
| | fixed ("'f'") format, followed by a percent sign. |
|
||||
|
@ -5500,10 +5520,16 @@ Replacing "%x" and "%o" and converting the value to different bases:
|
|||
>>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)
|
||||
'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'
|
||||
|
||||
Using the comma as a thousands separator:
|
||||
Using the comma or the underscore as a digit group separator:
|
||||
|
||||
>>> '{:,}'.format(1234567890)
|
||||
'1,234,567,890'
|
||||
>>> '{:_}'.format(1234567890)
|
||||
'1_234_567_890'
|
||||
>>> '{:_b}'.format(1234567890)
|
||||
'100_1001_1001_0110_0000_0010_1101_0010'
|
||||
>>> '{:_x}'.format(1234567890)
|
||||
'4996_02d2'
|
||||
|
||||
Expressing a percentage:
|
||||
|
||||
|
@ -5563,7 +5589,7 @@ section The standard type hierarchy):
|
|||
parameter_list_no_posonly ::= defparameter ("," defparameter)* ["," [parameter_list_starargs]]
|
||||
| parameter_list_starargs
|
||||
parameter_list_starargs ::= "*" [star_parameter] ("," defparameter)* ["," [parameter_star_kwargs]]
|
||||
"*" ("," defparameter)+ ["," [parameter_star_kwargs]]
|
||||
| "*" ("," defparameter)+ ["," [parameter_star_kwargs]]
|
||||
| parameter_star_kwargs
|
||||
parameter_star_kwargs ::= "**" parameter [","]
|
||||
parameter ::= identifier [":" expression]
|
||||
|
@ -11567,7 +11593,7 @@ class dict(iterable, **kwargs)
|
|||
to be a mutable object such as an empty list. To get distinct
|
||||
values, use a dict comprehension instead.
|
||||
|
||||
get(key, default=None)
|
||||
get(key, default=None, /)
|
||||
|
||||
Return the value for *key* if *key* is in the dictionary, else
|
||||
*default*. If *default* is not given, it defaults to "None", so
|
||||
|
@ -11608,7 +11634,7 @@ class dict(iterable, **kwargs)
|
|||
|
||||
Added in version 3.8.
|
||||
|
||||
setdefault(key, default=None)
|
||||
setdefault(key, default=None, /)
|
||||
|
||||
If *key* is in the dictionary, return its value. If not, insert
|
||||
*key* with a value of *default* and return *default*. *default*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue