[Python-Dev] Re: 2.4a2, and @decorators

Jim Fulton jim at zope.com
Wed Aug 4 17:00:37 CEST 2004


Bob Ippolito wrote:
> 
...

 > Your proposal would make decorators nearly as
> bad as the current pre-2.4 situation.  This is REALLY ugly:
> 
> foo = decorator(....)
> @foo
> def fun(....):
>     ...

I agree, that's really ugly.  I wasn't proposing that.

I proposed not allowing decorator arguments. Without decorator arguments,
a much simpler syntax can be used, as in:

   def classmethod foo(...):
       ...

Or, alternatively, I'm proposing allowing the above simpler syntax
when arguments are not needed and allowing the pie syntax to handle
more complex cases.

The original motivation for decirators was to deal with things like
properties and specialized methods.  I'd like to see these cases handled
well.  I think these are going to be the most common cases and the cases
that new Python programmers are most likely to come accross.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Python-Dev mailing list