Decorators: J2 and a relation to @

  • Thread starter Shane Holloway (IEEE)
  • Start date
S

Shane Holloway (IEEE)

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,279
Latest member
LaRoseDermaBottle

Latest Threads

Top