Decorators: J2 and a relation to @
Shane Holloway (IEEE)
shane.holloway at ieee.org
Tue Aug 24 18:55:46 EDT 2004
Decorators. Yep, in your inbox again. I'll be short about it. But
first, I should put out a disclaimer: I'm not opposed to the pie-syntax.
I'm just tired of writing my method names three times, and having the
important 'classmethod' below the function.
Now... on with it!
From the example in Section II, part 3 of
http://www.aminus.org/rbre/python/pydec.html consider the following
decorated function.
@using([
funcattrs(author="Guido van Rossum"),
memorize,
synchronize,
classmethod,
])
def foo(cls, *args):
pass
This looks an lot like the suite method proposed in J2 in the current
syntax of Python 2.4a2. All that would need to be added is a "using"
decorator method. I like the @ because it makes me take note that the
following is special in terms of code execution.[*]
What do you think?
-Shane Holloway
[*] I could actually see @ being used to introduce smalltalk/ruby-esk
block closures... but that's a totally different discussion for a much
different time. <1.2-wink>
More information about the Python-list
mailing list