Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types requ
special recursion handling. In addition to protecting the stack,
:c:member:`~PyTypeObject.tp_repr` also needs to track objects to prevent cycles. The
following two functions facilitate this functionality. Effectively,
these are the C equivalent to :func:`reprlib.recursive_repr`.
these are the C equivalent to :deco:`reprlib.recursive_repr`.

.. c:function:: int Py_ReprEnter(PyObject *object)

Expand Down
6 changes: 3 additions & 3 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ method.

The method will be passed the type object as the first parameter rather
than an instance of the type. This is used to create *class methods*,
similar to what is created when using the :func:`classmethod` built-in
function.
similar to what is created when using the :deco:`classmethod` built-in
decorator.


.. c:macro:: METH_STATIC
Expand All @@ -429,7 +429,7 @@ method.

The method will be passed ``NULL`` as the first parameter rather than an
instance of the type. This is used to create *static methods*, similar to
what is created when using the :func:`staticmethod` built-in function.
what is created when using the :deco:`staticmethod` built-in decorator.

One other constant controls whether a method is loaded in place of another
definition with the same method name.
Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Pending removal in Python 3.15
Use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``
to create a TypedDict with zero field.

* The :func:`!typing.no_type_check_decorator` decorator function
* The :deco:`!typing.no_type_check_decorator` decorator function
has been deprecated since Python 3.13.
After eight years in the :mod:`typing` module,
it has yet to be supported by any major type checker.
Expand Down
2 changes: 1 addition & 1 deletion Doc/faq/programming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ How do I cache method calls?
----------------------------

The two principal tools for caching methods are
:func:`functools.cached_property` and :func:`functools.lru_cache`. The
:deco:`functools.cached_property` and :deco:`functools.lru_cache`. The
former stores results at the instance level and the latter at the class
level.

Expand Down
4 changes: 2 additions & 2 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ Glossary
decorator
A function returning another function, usually applied as a function
transformation using the ``@wrapper`` syntax. Common examples for
decorators are :func:`classmethod` and :func:`staticmethod`.
decorators are :deco:`classmethod` and :deco:`staticmethod`.

The decorator syntax is merely syntactic sugar, the following two
function definitions are semantically equivalent::
Expand Down Expand Up @@ -622,7 +622,7 @@ Glossary
determined by the dispatch algorithm.

See also the :term:`single dispatch` glossary entry, the
:func:`functools.singledispatch` decorator, and :pep:`443`.
:deco:`functools.singledispatch` decorator, and :pep:`443`.

generic type
A :term:`type` that can be parameterized; typically a
Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ on an arbitrary object ``o``:
as the ``globals``, and ``dict(vars(o))`` as the ``locals``,
when calling :func:`eval`.
* If ``o`` is a wrapped callable using :func:`functools.update_wrapper`,
:func:`functools.wraps`, or :func:`functools.partial`, iteratively
:deco:`functools.wraps`, or :func:`functools.partial`, iteratively
unwrap it by accessing either ``o.__wrapped__`` or ``o.func`` as
appropriate, until you have found the root unwrapped function.
* If ``o`` is a callable (but not a class), use
Expand Down
12 changes: 6 additions & 6 deletions Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This guide has four major sections:
4) The last section has pure Python equivalents for built-in descriptors that
are written in C. Read this if you're curious about how functions turn
into bound methods or about the implementation of common tools like
:func:`classmethod`, :func:`staticmethod`, :func:`property`, and
:deco:`classmethod`, :deco:`staticmethod`, :deco:`property`, and
:term:`__slots__`.


Expand Down Expand Up @@ -317,8 +317,8 @@ Descriptors invert that relationship and allow the data being looked-up to
have a say in the matter.

Descriptors are used throughout the language. It is how functions turn into
bound methods. Common tools like :func:`classmethod`, :func:`staticmethod`,
:func:`property`, and :func:`functools.cached_property` are all implemented as
bound methods. Common tools like :deco:`classmethod`, :deco:`staticmethod`,
:deco:`property`, and :deco:`functools.cached_property` are all implemented as
descriptors.


Expand Down Expand Up @@ -1326,7 +1326,7 @@ example calls are unexciting:
30

Using the non-data descriptor protocol, a pure Python version of
:func:`staticmethod` would look like this:
:deco:`staticmethod` would look like this:

.. testcode::

Expand Down Expand Up @@ -1466,7 +1466,7 @@ Now a new dictionary of unique keys can be constructed like this:
{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}

Using the non-data descriptor protocol, a pure Python version of
:func:`classmethod` would look like this:
:deco:`classmethod` would look like this:

.. testcode::

Expand Down Expand Up @@ -1604,7 +1604,7 @@ matters when a large number of instances are going to be created.
4. Improves speed. Reading instance variables is 35% faster with
``__slots__`` (as measured with Python 3.10 on an Apple M1 processor).

5. Blocks tools like :func:`functools.cached_property` which require an
5. Blocks tools like :deco:`functools.cached_property` which require an
instance dictionary to function correctly:

.. testcode::
Expand Down
4 changes: 2 additions & 2 deletions Doc/howto/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Ensuring unique enumeration values
----------------------------------

By default, enumerations allow multiple names as aliases for the same value.
When this behavior isn't desired, you can use the :func:`unique` decorator::
When this behavior isn't desired, you can use the :deco:`unique` decorator::

>>> from enum import Enum, unique
>>> @unique
Expand Down Expand Up @@ -509,7 +509,7 @@ to use the standard :func:`repr`.

.. note::

Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum`
Adding :deco:`~dataclasses.dataclass` decorator to :class:`Enum`
and its subclasses is not supported. It will not raise any errors,
but it will produce very strange results at runtime, such as members
being equal to each other::
Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/sorting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ Odds and Ends
:meth:`~object.__lt__` is not implemented (see :func:`object.__lt__`
for details on the mechanics). To avoid surprises, :pep:`8`
recommends that all six comparison methods be implemented.
The :func:`~functools.total_ordering` decorator is provided to make that
The :deco:`~functools.total_ordering` decorator is provided to make that
task easier.

* Key functions need not depend directly on the objects being sorted. A key
Expand Down
38 changes: 19 additions & 19 deletions Doc/library/abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,17 @@ The :mod:`!abc` module also provides the following decorator:
or is derived from it. A class that has a metaclass derived from
:class:`!ABCMeta` cannot be instantiated unless all of its abstract methods
and properties are overridden. The abstract methods can be called using any
of the normal 'super' call mechanisms. :func:`!abstractmethod` may be used
of the normal 'super' call mechanisms. :deco:`!abstractmethod` may be used
to declare abstract methods for properties and descriptors.

Dynamically adding abstract methods to a class, or attempting to modify the
abstraction status of a method or class once it is created, are only
supported using the :func:`update_abstractmethods` function. The
:func:`!abstractmethod` only affects subclasses derived using regular
:deco:`!abstractmethod` only affects subclasses derived using regular
inheritance; "virtual subclasses" registered with the ABC's
:meth:`~ABCMeta.register` method are not affected.

When :func:`!abstractmethod` is applied in combination with other method
When :deco:`!abstractmethod` is applied in combination with other method
descriptors, it should be applied as the innermost decorator, as shown in
the following usage examples::

Expand Down Expand Up @@ -218,7 +218,7 @@ The :mod:`!abc` module also provides the following decorator:
the descriptor must identify itself as abstract using
:attr:`!__isabstractmethod__`. In general, this attribute should be ``True``
if any of the methods used to compose the descriptor are abstract. For
example, Python's built-in :class:`property` does the equivalent of::
example, Python's built-in :deco:`property` does the equivalent of::

class Descriptor:
...
Expand All @@ -242,13 +242,13 @@ The :mod:`!abc` module also supports the following legacy decorators:

.. versionadded:: 3.2
.. deprecated:: 3.3
It is now possible to use :class:`classmethod` with
:func:`abstractmethod`, making this decorator redundant.
It is now possible to use :deco:`classmethod` with
:deco:`abstractmethod`, making this decorator redundant.

A subclass of the built-in :func:`classmethod`, indicating an abstract
classmethod. Otherwise it is similar to :func:`abstractmethod`.
A subclass of the built-in :class:`classmethod`, indicating an abstract
classmethod. Otherwise it is similar to :deco:`abstractmethod`.

This special case is deprecated, as the :func:`classmethod` decorator
This special case is deprecated, as the :deco:`classmethod` decorator
is now correctly identified as abstract when applied to an abstract
method::

Expand All @@ -263,13 +263,13 @@ The :mod:`!abc` module also supports the following legacy decorators:

.. versionadded:: 3.2
.. deprecated:: 3.3
It is now possible to use :class:`staticmethod` with
:func:`abstractmethod`, making this decorator redundant.
It is now possible to use :deco:`staticmethod` with
:deco:`abstractmethod`, making this decorator redundant.

A subclass of the built-in :func:`staticmethod`, indicating an abstract
staticmethod. Otherwise it is similar to :func:`abstractmethod`.
A subclass of the built-in :class:`staticmethod`, indicating an abstract
staticmethod. Otherwise it is similar to :deco:`abstractmethod`.

This special case is deprecated, as the :func:`staticmethod` decorator
This special case is deprecated, as the :deco:`staticmethod` decorator
is now correctly identified as abstract when applied to an abstract
method::

Expand All @@ -283,14 +283,14 @@ The :mod:`!abc` module also supports the following legacy decorators:
.. decorator:: abstractproperty

.. deprecated:: 3.3
It is now possible to use :class:`property`, :meth:`property.getter`,
:meth:`property.setter` and :meth:`property.deleter` with
:func:`abstractmethod`, making this decorator redundant.
It is now possible to use :deco:`property`, :deco:`property.getter`,
:deco:`property.setter` and :deco:`property.deleter` with
:deco:`abstractmethod`, making this decorator redundant.

A subclass of the built-in :func:`property`, indicating an abstract
A subclass of the built-in :class:`property`, indicating an abstract
property.

This special case is deprecated, as the :func:`property` decorator
This special case is deprecated, as the :deco:`property` decorator
is now correctly identified as abstract when applied to an abstract
method::

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/bisect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ thoughts in mind:
they are used. Consequently, if the search functions are used in a loop,
the key function may be called again and again on the same array elements.
If the key function isn't fast, consider wrapping it with
:py:func:`functools.cache` to avoid duplicate computations. Alternatively,
:py:deco:`functools.cache` to avoid duplicate computations. Alternatively,
consider searching an array of precomputed keys to locate the insertion
point (as shown in the examples section below).

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ original insertion position is changed and moved to the end::
self.move_to_end(key)

An :class:`OrderedDict` would also be useful for implementing
variants of :func:`functools.lru_cache`:
variants of :deco:`functools.lru_cache`:

.. testcode::

Expand Down
18 changes: 9 additions & 9 deletions Doc/library/contextlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ Functions and classes provided:
the exception has been handled, and execution will resume with the statement
immediately following the :keyword:`!with` statement.

:func:`contextmanager` uses :class:`ContextDecorator` so the context managers
:deco:`contextmanager` uses :class:`ContextDecorator` so the context managers
it creates can be used as decorators as well as in :keyword:`with` statements.
When used as a decorator, a new generator instance is implicitly created on
each function call (this allows the otherwise "one-shot" context managers
created by :func:`contextmanager` to meet the requirement that context
created by :deco:`contextmanager` to meet the requirement that context
managers support multiple invocations in order to be used as decorators).

.. versionchanged:: 3.2
Expand All @@ -101,7 +101,7 @@ Functions and classes provided:

.. decorator:: asynccontextmanager

Similar to :func:`~contextlib.contextmanager`, but creates an
Similar to :deco:`~contextlib.contextmanager`, but creates an
:ref:`asynchronous context manager <async-context-managers>`.

This function is a :term:`decorator` that can be used to define a factory
Expand All @@ -128,7 +128,7 @@ Functions and classes provided:

.. versionadded:: 3.7

Context managers defined with :func:`asynccontextmanager` can be used
Context managers defined with :deco:`asynccontextmanager` can be used
either as decorators or with :keyword:`async with` statements::

import time
Expand All @@ -148,11 +148,11 @@ Functions and classes provided:

When used as a decorator, a new generator instance is implicitly created on
each function call. This allows the otherwise "one-shot" context managers
created by :func:`asynccontextmanager` to meet the requirement that context
created by :deco:`asynccontextmanager` to meet the requirement that context
managers support multiple invocations in order to be used as decorators.

.. versionchanged:: 3.10
Async context managers created with :func:`asynccontextmanager` can
Async context managers created with :deco:`asynccontextmanager` can
be used as decorators.


Expand Down Expand Up @@ -399,7 +399,7 @@ Functions and classes provided:
``__enter__`` and ``__exit__`` as normal. ``__exit__`` retains its optional
exception handling even when used as a decorator.

``ContextDecorator`` is used by :func:`contextmanager`, so you get this
``ContextDecorator`` is used by :deco:`contextmanager`, so you get this
functionality automatically.

Example of ``ContextDecorator``::
Expand Down Expand Up @@ -653,7 +653,7 @@ Functions and classes provided:

Similar to :meth:`ExitStack.close` but properly handles awaitables.

Continuing the example for :func:`asynccontextmanager`::
Continuing the example for :deco:`asynccontextmanager`::

async with AsyncExitStack() as stack:
connections = [await stack.enter_async_context(get_connection())
Expand Down Expand Up @@ -911,7 +911,7 @@ Files are an example of effectively single use context managers, since
the first :keyword:`with` statement will close the file, preventing any
further IO operations using that file object.

Context managers created using :func:`contextmanager` are also single use
Context managers created using :deco:`contextmanager` are also single use
context managers, and will complain about the underlying generator failing
to yield if an attempt is made to use them a second time::

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/ctypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ object with an :attr:`!_as_parameter_` attribute::
>>>

If you don't want to store the instance's data in the :attr:`!_as_parameter_`
instance variable, you could define a :class:`property` which makes the
instance variable, you could define a :deco:`property` which makes the
attribute available on request.


Expand Down
14 changes: 7 additions & 7 deletions Doc/library/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,30 +120,30 @@ Module Contents
:class:`StrEnum` defaults to the lower-cased version of the member name,
while other Enums default to 1 and increase from there.

:func:`~enum.property`
:deco:`~enum.property`

Allows :class:`Enum` members to have attributes without conflicting with
member names. The ``value`` and ``name`` attributes are implemented this
way.

:func:`unique`
:deco:`unique`

Enum class decorator that ensures only one name is bound to any one value.

:func:`verify`
:deco:`verify`

Enum class decorator that checks user-selectable constraints on an
enumeration.

:func:`member`
:deco:`member`

Make ``obj`` a member. Can be used as a decorator.

:func:`nonmember`
:deco:`nonmember`

Do not make ``obj`` a member. Can be used as a decorator.

:func:`global_enum`
:deco:`global_enum`

Modify the :class:`str() <str>` and :func:`repr` of an enum
to show its members as belonging to the module instead of its class,
Expand Down Expand Up @@ -969,7 +969,7 @@ Utilities and Decorators

.. decorator:: property

A decorator similar to the built-in *property*, but specifically for
A decorator similar to the built-in :deco:`property`, but specifically for
enumerations. It allows member attributes to have the same names as members
themselves.

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/fnmatch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Unless stated otherwise, "filename string" and "pattern string" either refer to
functions documented below do not allow to mix a :class:`!bytes` pattern with
a :class:`!str` filename, and vice-versa.

Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768
Finally, note that :deco:`functools.lru_cache` with a *maxsize* of 32768
is used to cache the (typed) compiled regex patterns in the following
functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`, :func:`.filterfalse`.

Expand Down
Loading
Loading