mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
bpo-33702: Add some missing links in production lists and do a little polish (GH-7259)
This commit is contained in:
parent
b6bb77c2b8
commit
caccca78e4
3 changed files with 25 additions and 25 deletions
|
@ -235,7 +235,7 @@ The :keyword:`try` statement specifies exception handlers and/or cleanup code
|
||||||
for a group of statements:
|
for a group of statements:
|
||||||
|
|
||||||
.. productionlist::
|
.. productionlist::
|
||||||
try_stmt: try1_stmt | try2_stmt
|
try_stmt: `try1_stmt` | `try2_stmt`
|
||||||
try1_stmt: "try" ":" `suite`
|
try1_stmt: "try" ":" `suite`
|
||||||
: ("except" [`expression` ["as" `identifier`]] ":" `suite`)+
|
: ("except" [`expression` ["as" `identifier`]] ":" `suite`)+
|
||||||
: ["else" ":" `suite`]
|
: ["else" ":" `suite`]
|
||||||
|
@ -384,7 +384,7 @@ This allows common :keyword:`try`...\ :keyword:`except`...\ :keyword:`finally`
|
||||||
usage patterns to be encapsulated for convenient reuse.
|
usage patterns to be encapsulated for convenient reuse.
|
||||||
|
|
||||||
.. productionlist::
|
.. productionlist::
|
||||||
with_stmt: "with" with_item ("," with_item)* ":" `suite`
|
with_stmt: "with" `with_item` ("," `with_item`)* ":" `suite`
|
||||||
with_item: `expression` ["as" `target`]
|
with_item: `expression` ["as" `target`]
|
||||||
|
|
||||||
The execution of the :keyword:`with` statement with one "item" proceeds as follows:
|
The execution of the :keyword:`with` statement with one "item" proceeds as follows:
|
||||||
|
@ -468,7 +468,8 @@ A function definition defines a user-defined function object (see section
|
||||||
:ref:`types`):
|
:ref:`types`):
|
||||||
|
|
||||||
.. productionlist::
|
.. productionlist::
|
||||||
funcdef: [`decorators`] "def" `funcname` "(" [`parameter_list`] ")" ["->" `expression`] ":" `suite`
|
funcdef: [`decorators`] "def" `funcname` "(" [`parameter_list`] ")"
|
||||||
|
: ["->" `expression`] ":" `suite`
|
||||||
decorators: `decorator`+
|
decorators: `decorator`+
|
||||||
decorator: "@" `dotted_name` ["(" [`argument_list` [","]] ")"] NEWLINE
|
decorator: "@" `dotted_name` ["(" [`argument_list` [","]] ")"] NEWLINE
|
||||||
dotted_name: `identifier` ("." `identifier`)*
|
dotted_name: `identifier` ("." `identifier`)*
|
||||||
|
@ -698,7 +699,8 @@ Coroutine function definition
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
.. productionlist::
|
.. productionlist::
|
||||||
async_funcdef: [`decorators`] "async" "def" `funcname` "(" [`parameter_list`] ")" ["->" `expression`] ":" `suite`
|
async_funcdef: [`decorators`] "async" "def" `funcname` "(" [`parameter_list`] ")"
|
||||||
|
: ["->" `expression`] ":" `suite`
|
||||||
|
|
||||||
.. index::
|
.. index::
|
||||||
keyword: async
|
keyword: async
|
||||||
|
|
|
@ -707,15 +707,14 @@ The :keyword:`import` statement
|
||||||
keyword: from
|
keyword: from
|
||||||
|
|
||||||
.. productionlist::
|
.. productionlist::
|
||||||
import_stmt: "import" `module` ["as" `name`] ( "," `module` ["as" `name`] )*
|
import_stmt: "import" `module` ["as" `identifier`] ("," `module` ["as" `identifier`])*
|
||||||
: | "from" `relative_module` "import" `identifier` ["as" `name`]
|
: | "from" `relative_module` "import" `identifier` ["as" `identifier`]
|
||||||
: ( "," `identifier` ["as" `name`] )*
|
: ("," `identifier` ["as" `identifier`])*
|
||||||
: | "from" `relative_module` "import" "(" `identifier` ["as" `name`]
|
: | "from" `relative_module` "import" "(" `identifier` ["as" `identifier`]
|
||||||
: ( "," `identifier` ["as" `name`] )* [","] ")"
|
: ("," `identifier` ["as" `identifier`])* [","] ")"
|
||||||
: | "from" `module` "import" "*"
|
: | "from" `module` "import" "*"
|
||||||
module: (`identifier` ".")* `identifier`
|
module: (`identifier` ".")* `identifier`
|
||||||
relative_module: "."* `module` | "."+
|
relative_module: "."* `module` | "."+
|
||||||
name: `identifier`
|
|
||||||
|
|
||||||
The basic import statement (no :keyword:`from` clause) is executed in two
|
The basic import statement (no :keyword:`from` clause) is executed in two
|
||||||
steps:
|
steps:
|
||||||
|
@ -837,12 +836,11 @@ features on a per-module basis before the release in which the feature becomes
|
||||||
standard.
|
standard.
|
||||||
|
|
||||||
.. productionlist:: *
|
.. productionlist:: *
|
||||||
future_statement: "from" "__future__" "import" feature ["as" name]
|
future_stmt: "from" "__future__" "import" `feature` ["as" `identifier`]
|
||||||
: ("," feature ["as" name])*
|
: ("," `feature` ["as" `identifier`])*
|
||||||
: | "from" "__future__" "import" "(" feature ["as" name]
|
: | "from" "__future__" "import" "(" `feature` ["as" `identifier`]
|
||||||
: ("," feature ["as" name])* [","] ")"
|
: ("," `feature` ["as" `identifier`])* [","] ")"
|
||||||
feature: identifier
|
feature: `identifier`
|
||||||
name: identifier
|
|
||||||
|
|
||||||
A future statement must appear near the top of the module. The only lines that
|
A future statement must appear near the top of the module. The only lines that
|
||||||
can appear before a future statement are:
|
can appear before a future statement are:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue