diff options
author | Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> | 2025-04-08 14:20:32 +0300 |
---|---|---|
committer | Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> | 2025-04-08 14:20:51 +0300 |
commit | 29af6cee02fbe74d59c6d725a506fe60c77d37d6 (patch) | |
tree | daa7d8cdc6601fa4a99e51c2f02a1e9aeae51ea1 /Lib/pydoc_data | |
parent | 0f04f2456a2ff996cc670342a287928ab5f9b706 (diff) | |
download | cpython-29af6cee02fbe74d59c6d725a506fe60c77d37d6.tar.gz cpython-29af6cee02fbe74d59c6d725a506fe60c77d37d6.zip |
Python 3.14.0a7v3.14.0a7
Diffstat (limited to 'Lib/pydoc_data')
-rw-r--r-- | Lib/pydoc_data/topics.py | 126 |
1 files changed, 74 insertions, 52 deletions
diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index f949b96aa56..3f3d52dcc6b 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,4 +1,4 @@ -# Autogenerated by Sphinx on Wed Mar 19 18:40:00 2025 +# Autogenerated by Sphinx on Tue Apr 8 14:20:44 2025 # as part of the release process. topics = { @@ -1784,6 +1784,10 @@ Additional information on exceptions can be found in section Exceptions, and information on using the "raise" statement to generate exceptions may be found in section The raise statement. +Changed in version 3.14.0a6 (unreleased): Support for optionally +dropping grouping parentheses when using multiple exception types. See +**PEP 758**. + "except" clause --------------- @@ -1797,10 +1801,12 @@ expression-less "except" clause, if present, must be last; it matches any exception. For an "except" clause with an expression, the expression must -evaluate to an exception type or a tuple of exception types. The -raised exception matches an "except" clause whose expression evaluates -to the class or a *non-virtual base class* of the exception object, or -to a tuple that contains such a class. +evaluate to an exception type or a tuple of exception types. +Parentheses can be dropped if multiple exception types are provided +and the "as" clause is not used. The raised exception matches an +"except" clause whose expression evaluates to the class or a *non- +virtual base class* of the exception object, or to a tuple that +contains such a class. If no "except" clause matches the exception, the search for an exception handler continues in the surrounding code and on the @@ -2697,7 +2703,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] @@ -5279,11 +5285,11 @@ The general form of a *standard format specifier* is: align: "<" | ">" | "=" | "^" sign: "+" | "-" | " " width_and_precision: [width_with_grouping][precision_with_grouping] - width_with_grouping: [width][grouping_option] - precision_with_grouping: "." [precision]grouping_option + width_with_grouping: [width][grouping] + precision_with_grouping: "." [precision][grouping] width: digit+ - grouping_option: "_" | "," precision: digit+ + grouping: "," | "_" type: "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%" @@ -5327,13 +5333,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. | +-----------+------------------------------------------------------------+ @@ -5356,26 +5362,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 @@ -5393,11 +5383,33 @@ maximum field size - in other words, how many characters will be used from the field content. The *precision* is not allowed for integer presentation types. -The "'_'" or "','" option after *precision* means the use of an -underscore or a comma for a thousands separator of the fractional part -for floating-point presentation types. +The *grouping* option after *width* and *precision* fields specifies a +digit group separator for the integral and fractional parts of a +number respectively. It can be one of the following: -Changed in version 3.14: Support thousands separators for the ++-----------+------------------------------------------------------------+ +| 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**). + +Changed in version 3.14: Support the *grouping* option for the fractional part. Finally, the *type* determines how the data should be presented. @@ -5436,8 +5448,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'". | +-----------+------------------------------------------------------------+ @@ -5508,8 +5520,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. | @@ -5632,18 +5644,22 @@ 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 or the underscore 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' >>> '{:_}'.format(123456789.123456789) '123_456_789.12345679' - >>> '{:._}'.format(123456789.123456789) - '123456789.123_456_79' - >>> '{:_._}'.format(123456789.123456789) - '123_456_789.123_456_79' + >>> '{:.,}'.format(123456789.123456789) + '123456789.123,456,79' + >>> '{:,._}'.format(123456789.123456789) + '123,456,789.123_456_79' Expressing a percentage: @@ -5703,7 +5719,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] @@ -10084,6 +10100,10 @@ Additional information on exceptions can be found in section Exceptions, and information on using the "raise" statement to generate exceptions may be found in section The raise statement. +Changed in version 3.14.0a6 (unreleased): Support for optionally +dropping grouping parentheses when using multiple exception types. See +**PEP 758**. + "except" clause =============== @@ -10097,10 +10117,12 @@ expression-less "except" clause, if present, must be last; it matches any exception. For an "except" clause with an expression, the expression must -evaluate to an exception type or a tuple of exception types. The -raised exception matches an "except" clause whose expression evaluates -to the class or a *non-virtual base class* of the exception object, or -to a tuple that contains such a class. +evaluate to an exception type or a tuple of exception types. +Parentheses can be dropped if multiple exception types are provided +and the "as" clause is not used. The raised exception matches an +"except" clause whose expression evaluates to the class or a *non- +virtual base class* of the exception object, or to a tuple that +contains such a class. If no "except" clause matches the exception, the search for an exception handler continues in the surrounding code and on the @@ -11782,7 +11804,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 @@ -11823,7 +11845,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* |