[docs] [issue36913] Missing documentation for decorators

Stéphane Wirtel report at bugs.python.org
Tue May 14 04:34:32 EDT 2019


Stéphane Wirtel <stephane at wirtel.be> added the comment:

Hi,

Thank you for your feedback.

In fact, there is a limitation with the current search engine of Sphinx (because we use it for the documentation). For example, if you try to find the meaning of "for", for us it's a keyword but for the search engine, it will try to find all the sections containing "for" (formatter, platform, argparse.ArgumentParser.format_help, etc...).

For that, we could open an issue on the repository of Sphinx.

Now, about the decorators.

In the definition of a function, we explain the call of a decorator, See the grammar. https://docs.python.org/3/reference/compound_stmts.html#function-definitions

"""
A function definition may be wrapped by one or more decorator expressions. Decorator expressions are evaluated when the function is defined, in the scope that contains the function definition. The result must be a callable, which is invoked with the function object as the only argument. The returned value is bound to the function name instead of the function object. Multiple decorators are applied in a nested fashion. For example, the following code
"""

But because it's a specification of the language which has been described with 2 PEPs you can read it on the PEP Index page.

Function: https://www.python.org/dev/peps/pep-0318/ 
-> Introduced in 2.4 https://docs.python.org/3/whatsnew/2.4.html

Class: https://www.python.org/dev/peps/pep-3129/
-> Introduced in 3.0

Now, I suggest one thing, add a link to the PEPs in this section https://docs.python.org/3/reference/compound_stmts.html#function-definitions

----------
nosy: +matrixise

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36913>
_______________________________________


More information about the docs mailing list