[docs] [issue31567] Inconsistent documentation around decorators

Éric Araujo report at bugs.python.org
Mon Oct 2 14:47:07 EDT 2017

Éric Araujo <merwok at netwok.org> added the comment:

> What does @ mean here? If there's some meaning, the next question is, why doc for staticmethod()
> (and classmethod() in the same page) does not have it?

@ means that the function is meant to be used as a decorator (the markup looks like the actual code).

staticmethod and classmethod are older than the decorator syntax, which is older than the special sphinx markup for decorators (they used to just use the function markup).

For unittest.mock.patch, its result can be used as a decorator or as a context manager, so the current markup (no @) makes sense.

If you want to update staticmethod and classmethod to use the decorator markup, please send a pull request!  (more info in the devguide)

nosy: +merwok

Python tracker <report at bugs.python.org>

More information about the docs mailing list