Python "object" as root object

Fredrik Lundh fredrik at pythonware.com
Thu May 26 09:25:22 BST 2005


John A Meinel wrote:

> >(It seems that method decorators like classmethod and staticmethod do
> >work ok with old-style classes though.)

> classmethod/staticmethod aren't decorators in the 'decorators' sense.
> They return a new function object. Decorators are something like:
> class myclass:
>     @classmethod
>     def test(cls, x, y):
>         pass

your description is a bit misleading; the @ syntax maps the object being
defined through an expression, so that "@classmethod" decorator ends up
calling the "classmethod" function.

</F> 







More information about the bazaar mailing list