[Python-Dev] pep 318, Decorators for Functions, Methods and Classes (original) (raw)

Phillip J. Eby pje at telecommunity.com
Fri Aug 6 20:21:07 CEST 2004


At 08:55 AM 8/6/04 -0700, Guido van Rossum wrote:

It would seem that the functionality isn't quite as useful there; you can get most of the same effects with metaclasses. I'm not aware of any idiom that takes a class and passes it through some kind of wrapper or transformation after the class declaration; if somebody is using this, it surely must be a very rare use indeed.

Zope and PyProtocols use this approach for inline interface declarations, though it's implemented by _getframe and a temporary metaclass. E.g. Zope's:

class Foo: implements(IFoo)

works by effectively applying a decorator to the finished class. PyProtocols doesn't change the class in the process, but I think Zope might (e.g. to set implements).



More information about the Python-Dev mailing list