mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
3.7.0b5
This commit is contained in:
parent
0e823c6efa
commit
abb8802389
64 changed files with 774 additions and 122 deletions
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Autogenerated by Sphinx on Wed May 2 03:29:32 2018
|
||||
# Autogenerated by Sphinx on Wed May 30 19:43:20 2018
|
||||
topics = {'assert': 'The "assert" statement\n'
|
||||
'**********************\n'
|
||||
'\n'
|
||||
|
@ -403,6 +403,134 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'See also: **PEP 526** - Variable and attribute annotation '
|
||||
'syntax\n'
|
||||
' **PEP 484** - Type hints\n',
|
||||
'async': 'Coroutines\n'
|
||||
'**********\n'
|
||||
'\n'
|
||||
'New in version 3.5.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Coroutine function definition\n'
|
||||
'=============================\n'
|
||||
'\n'
|
||||
' async_funcdef ::= [decorators] "async" "def" funcname "(" '
|
||||
'[parameter_list] ")" ["->" expression] ":" suite\n'
|
||||
'\n'
|
||||
'Execution of Python coroutines can be suspended and resumed at '
|
||||
'many\n'
|
||||
'points (see *coroutine*). In the body of a coroutine, any "await" '
|
||||
'and\n'
|
||||
'"async" identifiers become reserved keywords; "await" expressions,\n'
|
||||
'"async for" and "async with" can only be used in coroutine bodies.\n'
|
||||
'\n'
|
||||
'Functions defined with "async def" syntax are always coroutine\n'
|
||||
'functions, even if they do not contain "await" or "async" '
|
||||
'keywords.\n'
|
||||
'\n'
|
||||
'It is a "SyntaxError" to use "yield from" expressions in "async '
|
||||
'def"\n'
|
||||
'coroutines.\n'
|
||||
'\n'
|
||||
'An example of a coroutine function:\n'
|
||||
'\n'
|
||||
' async def func(param1, param2):\n'
|
||||
' do_stuff()\n'
|
||||
' await some_coroutine()\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'The "async for" statement\n'
|
||||
'=========================\n'
|
||||
'\n'
|
||||
' async_for_stmt ::= "async" for_stmt\n'
|
||||
'\n'
|
||||
'An *asynchronous iterable* is able to call asynchronous code in '
|
||||
'its\n'
|
||||
'*iter* implementation, and *asynchronous iterator* can call\n'
|
||||
'asynchronous code in its *next* method.\n'
|
||||
'\n'
|
||||
'The "async for" statement allows convenient iteration over\n'
|
||||
'asynchronous iterators.\n'
|
||||
'\n'
|
||||
'The following code:\n'
|
||||
'\n'
|
||||
' async for TARGET in ITER:\n'
|
||||
' BLOCK\n'
|
||||
' else:\n'
|
||||
' BLOCK2\n'
|
||||
'\n'
|
||||
'Is semantically equivalent to:\n'
|
||||
'\n'
|
||||
' iter = (ITER)\n'
|
||||
' iter = type(iter).__aiter__(iter)\n'
|
||||
' running = True\n'
|
||||
' while running:\n'
|
||||
' try:\n'
|
||||
' TARGET = await type(iter).__anext__(iter)\n'
|
||||
' except StopAsyncIteration:\n'
|
||||
' running = False\n'
|
||||
' else:\n'
|
||||
' BLOCK\n'
|
||||
' else:\n'
|
||||
' BLOCK2\n'
|
||||
'\n'
|
||||
'See also "__aiter__()" and "__anext__()" for details.\n'
|
||||
'\n'
|
||||
'It is a "SyntaxError" to use "async for" statement outside of an\n'
|
||||
'"async def" function.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'The "async with" statement\n'
|
||||
'==========================\n'
|
||||
'\n'
|
||||
' async_with_stmt ::= "async" with_stmt\n'
|
||||
'\n'
|
||||
'An *asynchronous context manager* is a *context manager* that is '
|
||||
'able\n'
|
||||
'to suspend execution in its *enter* and *exit* methods.\n'
|
||||
'\n'
|
||||
'The following code:\n'
|
||||
'\n'
|
||||
' async with EXPR as VAR:\n'
|
||||
' BLOCK\n'
|
||||
'\n'
|
||||
'Is semantically equivalent to:\n'
|
||||
'\n'
|
||||
' mgr = (EXPR)\n'
|
||||
' aexit = type(mgr).__aexit__\n'
|
||||
' aenter = type(mgr).__aenter__(mgr)\n'
|
||||
'\n'
|
||||
' VAR = await aenter\n'
|
||||
' try:\n'
|
||||
' BLOCK\n'
|
||||
' except:\n'
|
||||
' if not await aexit(mgr, *sys.exc_info()):\n'
|
||||
' raise\n'
|
||||
' else:\n'
|
||||
' await aexit(mgr, None, None, None)\n'
|
||||
'\n'
|
||||
'See also "__aenter__()" and "__aexit__()" for details.\n'
|
||||
'\n'
|
||||
'It is a "SyntaxError" to use "async with" statement outside of an\n'
|
||||
'"async def" function.\n'
|
||||
'\n'
|
||||
'See also: **PEP 492** - Coroutines with async and await syntax\n'
|
||||
'\n'
|
||||
'-[ Footnotes ]-\n'
|
||||
'\n'
|
||||
'[1] The exception is propagated to the invocation stack unless\n'
|
||||
' there is a "finally" clause which happens to raise another\n'
|
||||
' exception. That new exception causes the old one to be lost.\n'
|
||||
'\n'
|
||||
'[2] Currently, control “flows off the end” except in the case of\n'
|
||||
' an exception or the execution of a "return", "continue", or\n'
|
||||
' "break" statement.\n'
|
||||
'\n'
|
||||
'[3] A string literal appearing as the first statement in the\n'
|
||||
' function body is transformed into the function’s "__doc__"\n'
|
||||
' attribute and therefore the function’s *docstring*.\n'
|
||||
'\n'
|
||||
'[4] A string literal appearing as the first statement in the class\n'
|
||||
' body is transformed into the namespace’s "__doc__" item and\n'
|
||||
' therefore the class’s *docstring*.\n',
|
||||
'atom-identifiers': 'Identifiers (Names)\n'
|
||||
'*******************\n'
|
||||
'\n'
|
||||
|
@ -6222,13 +6350,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'Lambda expressions (sometimes called lambda forms) are used to '
|
||||
'create\n'
|
||||
'anonymous functions. The expression "lambda arguments: '
|
||||
'anonymous functions. The expression "lambda parameters: '
|
||||
'expression"\n'
|
||||
'yields a function object. The unnamed object behaves like a '
|
||||
'function\n'
|
||||
'object defined with:\n'
|
||||
'\n'
|
||||
' def <lambda>(arguments):\n'
|
||||
' def <lambda>(parameters):\n'
|
||||
' return expression\n'
|
||||
'\n'
|
||||
'See section Function definitions for the syntax of parameter '
|
||||
|
@ -8593,6 +8721,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'When a class definition is executed, the following steps '
|
||||
'occur:\n'
|
||||
'\n'
|
||||
'* MRO entries are resolved\n'
|
||||
'\n'
|
||||
'* the appropriate metaclass is determined\n'
|
||||
'\n'
|
||||
'* the class namespace is prepared\n'
|
||||
|
@ -8602,6 +8732,24 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'* the class object is created\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Resolving MRO entries\n'
|
||||
'---------------------\n'
|
||||
'\n'
|
||||
'If a base that appears in class definition is not an '
|
||||
'instance of\n'
|
||||
'"type", then an "__mro_entries__" method is searched on it. '
|
||||
'If found,\n'
|
||||
'it is called with the original bases tuple. This method must '
|
||||
'return a\n'
|
||||
'tuple of classes that will be used instead of this base. The '
|
||||
'tuple may\n'
|
||||
'be empty, in such case the original base is ignored.\n'
|
||||
'\n'
|
||||
'See also: **PEP 560** - Core support for typing module and '
|
||||
'generic\n'
|
||||
' types\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Determining the appropriate metaclass\n'
|
||||
'-------------------------------------\n'
|
||||
'\n'
|
||||
|
@ -8720,7 +8868,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'initialised\n'
|
||||
'correctly. Failing to do so will result in a '
|
||||
'"DeprecationWarning" in\n'
|
||||
'Python 3.6, and a "RuntimeWarning" in the future.\n'
|
||||
'Python 3.6, and a "RuntimeError" in Python 3.8.\n'
|
||||
'\n'
|
||||
'When using the default metaclass "type", or any metaclass '
|
||||
'that\n'
|
||||
|
@ -8872,6 +9020,32 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' module) to the language.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Emulating generic types\n'
|
||||
'=======================\n'
|
||||
'\n'
|
||||
'One can implement the generic class syntax as specified by '
|
||||
'**PEP 484**\n'
|
||||
'(for example "List[int]") by defining a special method\n'
|
||||
'\n'
|
||||
'classmethod object.__class_getitem__(cls, key)\n'
|
||||
'\n'
|
||||
' Return an object representing the specialization of a '
|
||||
'generic class\n'
|
||||
' by type arguments found in *key*.\n'
|
||||
'\n'
|
||||
'This method is looked up on the class object itself, and '
|
||||
'when defined\n'
|
||||
'in the class body, this method is implicitly a class '
|
||||
'method. Note,\n'
|
||||
'this mechanism is primarily reserved for use with static '
|
||||
'type hints,\n'
|
||||
'other usage is discouraged.\n'
|
||||
'\n'
|
||||
'See also: **PEP 560** - Core support for typing module and '
|
||||
'generic\n'
|
||||
' types\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Emulating callable objects\n'
|
||||
'==========================\n'
|
||||
'\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue