Why won't this decorator work?
Gregory Ewing
greg.ewing at canterbury.ac.nz
Mon Jul 4 04:22:37 EDT 2011
OKB (not okblacke) wrote:
> A decorator basically modifies a function/method, so that ALL
> subsequent calls to it will behave differently.
Furthermore, usually a decorator is used when for some
reason you *can't* achieve the same effect with code
inside the function itself.
For example, the classmethod() and staticmethod()
decorators return descriptors that have different
magical effects from a standard function object when
looked up in a class or instance. Since that magic
happens *before* the function is called, you can't
do the same thing using an ordinary function.
In this case, an ordinary function is quite sufficient,
and there is no need to involve a decorator.
--
Greg
More information about the Python-list
mailing list