Tin mới
“Why is Python Installed on my Computer?” FAQ
A tool that tries to convert Python 2.x code to Python 3.x code by handling most of the incompatibilities which can be detected by parsing the source and traversing the parse tree.
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 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
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.
contextvars: Context Variables
A variable which can have different values depending on its context. This is similar to Thread-Local Storage in which each execution thread may have a different value for a variable. However, with context variables, ther
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.
For more information about descriptors’ methods, see Implementing Descriptors or the Descriptor How To Guide.
Displays for lists, sets and dictionaries
A compact way to process all or part of the elements in an iterable and return a dictionary with the results. results = {n: n ** 2 for n in range(10)} generates a dictionary containing key n mapped to value n ** 2. See D
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.
__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.
A bytecode cache file that uses the hash rather than the last-modified time of the corresponding source file to determine its validity. See Cached bytecode invalidation.
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.
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
random: Generate pseudo-random numbers with various common distributions.
Annotated assignment statements
When annotating a variable or a class attribute, assignment is optional:
venv: Creation of virtual environments.
A cooperatively isolated runtime environment that allows Python users and applications to install and upgrade Python distribution packages without interfering with the behaviour of other Python applications running on th