About 50 results
Open links in new tab
  1. functools — Higher-order functions and operations on ... - Python

    3 days ago · The functools module is for higher-order functions: functions that act on or return other functions. In general, any callable object can be treated as a function for the purposes of this module. The functools module defines the following functions: @ functools. cache (user_function) ¶ Simple lightweight unbounded function cache.

  2. 9.8. functools — 高阶函数和可调用对象上的操作 — Python 2.7.18

    Feb 7, 2018 · functools 模块应用于高阶函数,即——参数或(和)返回值为其他函数的函数。通常来说,此模块的功能适用于所有可调用对象。 functools 模块定义了以下函数: functools.cmp_to_key (func) ¶. Transform an old-style comparison function to a key function.

  3. contextlib — Utilities for with-statement contexts - Python

    1 day ago · ContextDecorator makes it possible to use a context manager in both an ordinary with statement and also as a function decorator. For example, it is sometimes useful to wrap functions or groups of statements with a logger that can track the time of entry and time of exit.

  4. Glossary — Python 3.13.3 documentation

    4 days ago · See also the single dispatch glossary entry, the functools.singledispatch() decorator, and PEP 443. generic type¶ A type that can be parameterized; typically a container class such as list or dict. Used for type hints and annotations. For more details, see generic alias types, PEP 483, PEP 484, PEP 585, and the typing module. GIL¶

  5. operator — Standard operators as functions - Python

    2 days ago · The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expression x+y. Many function names are those used for special methods, without the double underscores.

  6. What’s New In Python 3.11 — Python 3.13.3 documentation

    May 9, 2021 · dataclass_transform may be used to decorate a class, metaclass, or a function that is itself a decorator.

  7. What’s New In Python 3.2

    functools¶ The functools module includes a new decorator for caching function calls. functools.lru_cache() can save repeated queries to an external resource whenever the results are expected to be the same. For example, adding a caching decorator to a database query function can save database accesses for popular searches:

  8. inspect — Inspect live objects — Python 3.13.3 documentation

    2 days ago · Accepts a wide range of Python callables, from plain functions and classes to functools.partial() objects. For objects defined in modules using stringized annotations (from __future__ import annotations), signature() will attempt to automatically un-stringize the annotations using get_annotations().

  9. Descriptor Guide — Python 3.13.3 documentation

    3 days ago · Descriptors are used throughout the language. It is how functions turn into bound methods. Common tools like classmethod(), staticmethod(), property(), and functools.cached_property() are all implemented as descriptors. Complete Practical Example ¶

  10. Annotations Best Practices — Python 3.13.3 documentation

    2 days ago · Python 3.10 adds a new function to the standard library: inspect.get_annotations(). In Python versions 3.10 and newer, calling this function is the best practice for accessing the annotations dict of any object that supports annotations.

Refresh