Glossary¶
>>>¶The default Python prompt of the interactive shell. Often seen for code examples which can be executed interactively in the interpreter.
...¶Can refer to:
The default Python prompt of the interactive shell when entering the code for an indented code block, when within a pair of matching left and right delimiters (parentheses, square brackets, curly braces or triple quotes), or after specifying a decorator.
The three dots form of the Ellipsis object.
- abstract base class¶
Abstract base classes complement duck-typing by providing a way to define interfaces when other techniques like
hasattr()would be clumsy or subtly wrong (for example with magic methods). ABCs introduce virtual subclasses, which are classes that don’t inherit from a class but are still recognized byisinstance()andissubclass(); see theabcmodule documentation. Python comes with many built-in ABCs for data structures (in thecollections.abcmodule), numbers (in thenumbersmodule), streams (in theiomodule), import finders and loaders (in theimportlib.abcmodule). You can create your own ABCs with theabcmodule.- annotate function¶
A function that can be called to retrieve the annotations of an object. This function is accessible as the
__annotate__attribute of functions, classes, and modules. Annotate functions are a subset of evaluate functions.- annotation¶
A label associated with a variable, a class attribute or a function parameter or return value, used by convention as a type hint.
Annotations of local variables cannot be accessed at runtime, but annotations of global variables, class attributes, and functions can be retrieved by calling
annotationlib.get_annotations()on modules, classes, and functions, respectively.See variable annotation, function annotation, PEP 484, PEP 526, and PEP 649, which describe this functionality. Also see Annotations Best Practices for best practices on working with annotations.
- argument¶
A value passed to a function (or method) when calling the function. There are two kinds of argument:
keyword argument: an argument preceded by an identifier (e.g.
name=) in a function call or passed as a value in a dictionary preceded by**. For example,3and5are both keyword arguments in the following calls tocomplex():complex(real=3, imag=5) complex(**{'real': 3, 'imag': 5})
positional argument: an argument that is not a keyword argument. Positional arguments can appear at the beginning of an argument list and/or be passed as elements of an iterable preceded by
*. For example,3and5are both positional arguments in the following calls:complex(3, 5) complex(*(3, 5))
Arguments are assigned to the named local variables in a function body. See the Calls section for the rules governing this assignment. Syntactically, any expression can be used to represent an argument; the evaluated value is assigned to the local variable.
See also the parameter glossary entry, the FAQ question on the difference between arguments and parameters, and PEP 362.
- asynchronous context manager¶
An object which controls the environment seen in an
async withstatement by defining__aenter__()and__aexit__()methods. Introduced by PEP 492.- asynchronous generator¶
A function which returns an asynchronous generator iterator. It looks like a coroutine function defined with
async defexcept that it containsyieldexpressions for producing a series of values usable in anasync forloop.Usually refers to an asynchronous generator function, but may refer to an asynchronous generator iterator in some contexts. In cases where the intended meaning isn’t clear, using the full terms avoids ambiguity.
An asynchronous generator function may contain
awaitexpressions as well asasync for, andasync withstatements.- asynchronous generator iterator¶
An object created by an asynchronous generator function.
This is an asynchronous iterator which when called using the
__anext__()method returns an awaitable object which will execute the body of the asynchronous generator function until the nextyieldexpression.Each
yieldtemporarily suspends processing, remembering the execution state (including local variables and pending try-statements). When the asynchronous generator iterator effectively resumes with another awaitable returned by__anext__(), it picks up where it left off. See PEP 492 and PEP 525.- asynchronous iterable¶
An object, that can be used in an
async forstatement. Must return an asynchronous iterator from its__aiter__()method. Introduced by PEP 492.- asynchronous iterator¶
An object that implements the
__aiter__()and