collections — Container datatypes — Python 3.16.0a0 documentation

docs.python.org

Tin mới

calendar — General calendar-related functions

collections.abc — Abstract Base Classes for Containers

Python Module Index

3.16.0a0 Documentation

The Python Standard Library

itertools.combinations_with_replacement()

To enumerate all distinct multisets of a given size over a given set of elements, see itertools.combinations_with_replacement():

object.__getitem__

If the default_factory attribute is None, this raises a KeyError exception with the key as argument.

defaultdict Examples¶

Using list as the default_factory, it is easy to group a sequence of key-value pairs into a dictionary of lists:

defaultdict Examples¶

Using list as the default_factory, it is easy to group a sequence of key-value pairs into a dictionary of lists:

keyword: Test whether a string is a keyword in Python.

Returns a new tuple subclass named typename. The new subclass is used to create tuple-like objects that have fields accessible by attribute lookup as well as being indexable and iterable. Instances of the subclass also h

keyword-only arguments

Changed in version 3.6: The verbose and rename parameters became keyword-only arguments.

csv: Write and read tabular data to and from delimited files.

Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of

sqlite3: A DB-API 2.0 implementation using SQLite 3.x.

Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of

Unpacking Argument Lists

Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of

types.SimpleNamespace()

See types.SimpleNamespace() for a mutable namespace based on an underlying dictionary instead of a tuple.

dataclasses: Generate special methods on user-defined classes.

The dataclasses module provides a decorator and functions for automatically adding generated special methods to user-defined classes.

@functools.lru_cache

It is straightforward to create an ordered dictionary variant that remembers the order the keys were last inserted. If a new entry overwrites an existing entry, the original insertion position is changed and moved to the