functools — Higher-order functions and operations on callable objects — Python 3.16.0a0 documentation

docs.python.org

Tin mới

itertools — Functions creating iterators for efficient looping

operator — Standard operators as functions

Python Module Index

3.16.0a0 Documentation

The Python Standard Library

Functional Programming Modules

How do I cache method calls?

Transform a method of a class into a property whose value is computed once and then cached as a normal attribute for the life of the instance. Similar to @property, with the addition of caching. Useful for expensive comp

Sorting Techniques

Transform an old-style comparison function to a key function. Used with tools that accept key functions (such as sorted(), min(), max(), heapq.nlargest(), heapq.nsmallest(), itertools.groupby()). This function is primari

abc.abstractmethod

Return a new partialmethod descriptor which behaves like partial except that it is designed to be used as a method definition rather than being directly callable.

pickle: Convert Python objects to streams of bytes and back.

Transform a function into a single-dispatch generic function.

abstract base class

Transform a function into a single-dispatch generic function.

function.__module__

To allow access to the original function for introspection and other purposes (e.g. bypassing a caching decorator such as @lru_cache), this function automatically adds a __wrapped__ attribute to the wrapper that refers t

definition.__name__

partial objects are callable objects created by partial(). They have three read-only attributes: