词汇表

>>>

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 Ellipsis 内置常量。

抽象基类

抽象基类补充 鸭子类型 通过提供接口定义方式,当其它技术像 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 by isinstance() and issubclass() ;见 abc module documentation. Python comes with many built-in ABCs for data structures (in the collections.abc module), numbers (in the numbers module), streams (in the io module), import finders and loaders (in the importlib.abc module). You can create your own ABCs with the abc 模块。

annotation

A label associated with a variable, a class attribute or a function parameter or return value, used by convention as a 类型提示 .

Annotations of local variables cannot be accessed at runtime, but annotations of global variables, class attributes, and functions are stored in the __annotations__ special attribute of modules, classes, and functions, respectively.

变量注解 , 函数注解 , PEP 484 and PEP 526 , which describe this functionality. Also see 注解最佳实践 for best practices on working with annotations.

argument

值被传递给 function (或 方法 ) 当调用函数时。有 2 种自变量:

  • 关键词自变量 : an argument preceded by an identifier (e.g. name= ) in a function call or passed as a value in a dictionary preceded by ** 。例如, 3 and 5 are both keyword arguments in the following calls to complex() :

    complex(real=3, imag=5)
    complex(**{'real': 3, 'imag': 5})