[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
- Previous message: [Python-Dev] Re: pep 318, Decorators for Functions, Methods and Classes
- Next message: [Python-Dev] I'd like to add an __iter__ method to unittest.TestSuite
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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).
- Previous message: [Python-Dev] Re: pep 318, Decorators for Functions, Methods and Classes
- Next message: [Python-Dev] I'd like to add an __iter__ method to unittest.TestSuite
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]