Rejecting the J2 decorators proposal

Nicolas Fleury nid_oizo at yahoo.com_remove_the_
Wed Sep 1 23:17:47 CEST 2004


Guido van Rossum wrote:
> A warning: some people have shown examples of extreme uses of
> decorators. I've seen decorators proposed for argument and return type
> annotations, and even one that used a decorator to create an object
> that did a regular expression substitution. Those uses are cute, but I
> recommend being conservative when deciding between using a decorator
> or some other approach, especially in code that will see a large
> audience (like 3rd party library packages). Using decorators for type
> annotations in particular looks tedious, and this particular
> application is so important that I expect Python 3000 will have
> optional type declarations integrated into the argument list.

One of my main concern with decorators is that they look complex for 
simple things like static methods and argument types.  I'm becomming 
off-topic, but in Python 3000, self could also become a keyword and make 
normal/static methods automatically and minimalistically.  I think it 
has some charm since self would only be necessary when used.  If class 
methods are useful, they can still be made with decorators.

> Thanks to everyone who read until the end of this message!

I was a J2 supporter and I'm happy with your decision.  Looking at the 
pool on Wiki, it seems many would have prefer an inside-body solution (I 
guess we're used to docstrings) (but it was considered ruled out, so we 
rallied on something else), but @decorators current syntax is very 
usable.  When I compare Python to other languages, there's no doubt we 
can trust your decisions.  Thanks to you for Python!

Regards,
Nicolas



More information about the Python-list mailing list