Glossary — Python 3.9.25 documentation

docs.python.org

Tin mới

“Why is Python Installed on my Computer?” FAQ

About these documents

Python documentation for the current stable release

Python documentation for the current stable release

The default Python prompt of the interactive shell. Often seen for code examples which can be executed interactively in the interpreter.

Python Module Index

3.9.25 Documentation

lib2to3: The 2to3 library

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

the difference between arguments and parameters

A value passed to a function (or method) when calling the function. There are two kinds of argument:

StopAsyncIteration

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

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

function definitions

A function returning another function, usually applied as a function transformation using the @wrapper syntax. Common examples for decorators are classmethod() and staticmethod().

Implementing Descriptors

For more information about descriptors’ methods, see Implementing Descriptors or the Descriptor How To Guide.

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

Dictionary view objects

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

formatted string literals

String literals prefixed with 'f' or 'F' are commonly called “f-strings” which is short for formatted string literals. See also PEP 498.

__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

functools.singledispatch()

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.

Cached bytecode invalidation

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.

itertools.groupby()

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.

operator: Functions corresponding to the standard operators.

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.

collections.defaultdict

A container object that supports arbitrary key lookups and implements the methods specified in the Mapping or MutableMapping abstract base classes. Examples include dict, collections.defaultdict, collections.OrderedDict

random: Generate pseudo-random numbers with various common distributions.

sys: Access system-specific parameters and functions.

The number of references to an object. When the reference count of an object drops to zero, it is deallocated. Reference counting is generally not visible to Python code, but it is a key element of the CPython implementa

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