Tin mới
abc: Abstract base classes according to :pep:`3119`.
collections.abc: Abstract base classes for containers
numbers: Numeric abstract base classes (Complex, Real, Integral, etc.).
io: Core tools for working with streams.
importlib.abc: Abstract base classes related to import
A callable that can be called to retrieve the annotations of an object. Annotate functions are usually functions, automatically generated as the __annotate__ attribute of functions, classes, and modules. Annotate functio
annotationlib.get_annotations()
A label associated with a variable, a class attribute or a function parameter or return value, used by convention as a type hint.
A label associated with a variable, a class attribute or a function parameter or return value, used by convention as a type hint.
the difference between arguments and parameters
A value passed to a function (or method) when calling the function. There are two kinds of argument:
An object that implements the __aiter__() and __anext__() methods. __anext__() must return an awaitable object. async for resolves the awaitables returned by an asynchronous iterator’s __anext__() method until it raises
Names (identifiers and keywords)
A value associated with an object which is usually referenced by name using dotted expressions. For example, if an object o has an attribute a it would be referenced as o.a.
math: Mathematical functions (sin() etc.).
cmath: Mathematical functions for complex numbers.
threading: Thread-based parallelism.
multiprocessing: Process-based parallelism.
The collection of keyvalue bindings associated with a particular contextvars.Context object and accessed via ContextVar objects. Also see context variable.
A function returning another function, usually applied as a function transformation using the @wrapper syntax. Common examples for decorators are @classmethod and @staticmethod.
For more information about descriptors’ methods, see Implementing Descriptors or the Descriptor How To Guide.
The objects returned from dict.keys(), dict.values(), and dict.items() are called dictionary views. They provide a dynamic view on the dictionary’s entries, which means that when the dictionary changes, the view reflects
Encoding and error handler used by Python to decode bytes from the operating system and encode Unicode to the operating system.
Encoding and error handler used by Python to decode bytes from the operating system and encode Unicode to the operating system.
An object that tries to find the loader for a module that is being imported.
Python support for free threading
A build of CPython that supports free threading, configured using the --disable-gil option before compilation.
Formally, as defined in the language execution model, a free variable is any variable used in a namespace which is not a local variable in that namespace. See closure variable for an example. Pragmatically, due to the na
__future__: Future statement definitions
A future statement, from __future__ import <feature>, directs the compiler to compile the current module using syntax or semantics that will become standard in a future release of Python. The __future__ module documents
gc: Interface to the cycle-detecting garbage collector.
The process of freeing memory when it is not used anymore. Python performs garbage collection via reference counting and a cyclic garbage collector that is able to detect and break reference cycles. The garbage collector
A function composed of multiple functions implementing the same operation for different types. Which implementation should be used during a call is determined by the dispatch algorithm.
typing: Support for type hints (see :pep:`484`).
A type that can be parameterized; typically a container class such as list or dict. Used for type hints and annotations.
IDLE — Python editor and shell
An Integrated Development and Learning Environment for Python. IDLE — Python editor and shell is a basic editor and interpreter environment which ships with the standard distribution of Python.
Immortal objects are a CPython implementation detail introduced in PEP 683.
A key function or collation function is a callable that returns a value used for sorting or ordering. For example, locale.strxfrm() is used to produce a sort key that is aware of locale specific sort conventions.
A key function or collation function is a callable that returns a value used for sorting or ordering. For example, locale.strxfrm() is used to produce a sort key that is aware of locale specific sort conventions.
Time complexity of operations on built-in types
A built-in Python sequence. Despite its name it is more akin to an array in other languages than to a linked list since access to elements is O(1). See Time complexity of operations on built-in types.
locale.setlocale(locale.LC_CTYPE, new_locale)
On Unix, it is the encoding of the LC_CTYPE locale. It can be set with locale.setlocale(locale.LC_CTYPE, new_locale).
A container object that supports arbitrary key lookups and implements the methods specified in the collections.abc.Mapping or collections.abc.MutableMapping abstract base classes. Examples include dict, collections.defau
The Python 2.3 Method Resolution Order
Method Resolution Order is the order in which base classes are searched for a member during lookup. See The Python 2.3 Method Resolution Order for details of the algorithm used by the Python interpreter since the 2.3 rel
random: Generate pseudo-random numbers with various common distributions.
Requirements for optional modules
An extension module that is part of the standard library, but may be absent in some builds of CPython, usually due to missing third-party libraries or because the module is not available for a given platform.
An object of type slice, used to describe a portion of a sequence. A slice object is created when using the slicing form of subscript notation, with colons inside square brackets, such as in variable_name[1:3:5].
The collection of packages, modules and extension modules distributed as a part of the official Python interpreter package. The exact membership of the collection may vary based on platform, available system libraries, o
In Python’s C API, “stealing” an argument means that ownership of the argument is transferred to the called function. The caller must not use that reference after the call. Generally, functions that “steal” an argument d
queue: A synchronized queue class.
Thread State and the Global Interpreter Lock
The information used by the CPython runtime to run in an OS thread. For example, this includes the current exception, if any, and the state of the bytecode interpreter.
tokenize: Lexical scanner for Python source code.
A small unit of source code, generated by the lexical analyzer (also called the tokenizer). Names, numbers, strings, operators, newlines and similar are represented by tokens.
token: Constants representing terminal nodes of the parse tree.
A small unit of source code, generated by the lexical analyzer (also called the tokenizer). Names, numbers, strings, operators, newlines and similar are represented by tokens.
Annotated assignment statements
When annotating a variable or a class attribute, assignment is optional: