Built-in Types — Python 3.14.7 documentation

docs.python.org

Tin mới

Truth Value Testing¶

Any object can be tested for truth value, for use in an if or while condition or as operand of the Boolean operations below.

the documentation for the yield expression

Python supports a concept of iteration over containers. This is implemented using two distinct methods; these are used to allow user-defined classes to support iteration. Sequences, described below in more detail, always

Time complexity of operations on built-in types

There are three basic sequence types: lists, tuples, and range objects. Additional sequence types tailored for processing of binary data and text strings are described in dedicated sections.

Alphabetic property defined in section 4.10 ‘Letters, Alphabetic, and Ideographic’ of the Unicode Standard

Textual data in Python is handled with str objects, or strings. Strings are immutable sequences of Unicode code points. String literals are written in a variety of ways:

Time complexity of operations on built-in types

A mapping object maps hashable values to arbitrary objects. Mappings are mutable objects. There is currently only one standard mapping type, the dictionary. (For other containers see the built-in list, set, and tuple cla

contextlib.contextmanager

Python’s with statement supports the concept of a runtime context defined by a context manager. This is implemented using a pair of methods that allow user-defined classes to define a runtime context that is entered befo

the documentation for the yield expression

Python’s generators provide a convenient way to implement the iterator protocol. If a container object’s __iter__() method is implemented as a generator, it will automatically return an iterator object (technically, a ge

Thread safety for list objects

Lists are mutable sequences, typically used to store collections of homogeneous items (where the precise degree of similarity will vary by application).

Alphabetic property defined in section 4.10 ‘Letters, Alphabetic, and Ideographic’ of the Unicode Standard

Strings implement all of the common sequence operations, along with the additional methods described below.

String and Bytes literals

Bytes objects are immutable sequences of single bytes. Since many major binary protocols are based on the ASCII text encoding, bytes objects offer several methods that are only valid when working with ASCII compatible da

Link to this heading

The only special operation on a module is attribute access: m.name, where m is a module and name accesses a name defined in m’s symbol table. Module attributes can be assigned to. (Note that the import statement is not,

Function definitions

Function objects are created by function definitions. The only operation on a function object is to call it: func(argument-list).

Numpy’s slicing and striding

This object is commonly used to indicate that something is omitted. It supports no special operations. There is exactly one ellipsis object, named Ellipsis (a built-in name). type(Ellipsis)() produces the Ellipsis single

sys.int_info.str_digits_check_threshold

Before Python starts up you can use an environment variable or an interpreter command line flag to configure the limit: