John Henry wrote:
> I see lots of this "@expose" thing in the TurboGear tutorial.  Is this
> a Python 2.4 feature? 

It's a decorator. The syntactic sugar for decorators is a Python 2.4
feature, but decorators by themselves are not. The 2.4 syntax is:

@decorator
def decorated(args):
  do_something

and is just a shortcut for

def decorated(args):
  do_something
decorated = decorator(decorated)

The decorator itself is any callable taking a callable as argument and
returning a callable. The builtin types classmethod and staticmethod are
decorators.

> I try to google for it and don't seem to come up
> with specific hit..

http://www.google.com/search?q=%2Bpython+%2B%40decorator
gives me =~ 619 000 answers...


> Does that mean using 2.3 is out of the question?

I don't know if TG runs on 2.3.x, but as far as decorators are
concerned, you can just use the 'explicit' syntax instead:

class MyController(...):
  def my_action(...):
    ...
  my_action = expose(my_action)


-- 
bruno desthuilliers
développeur
[EMAIL PROTECTED]
http://www.modulix.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to