[Python-Dev] Decorator syntax (original) (raw)

Xavier Morel xavier.morel at masklinn.net
Wed Sep 2 12:50:33 CEST 2009


On 2 Sep 2009, at 12:15 , Rob Cliffe wrote:

@Identity(DecoList[0]) # THIS WORKS def foo(): pass For what it's worth, you don't need an id function, you can simply write

 @itemgetter(0)(decorators)
 def foo():
     'whatever'

or

 @decorators.__getitem__(0)
 def foo():
     'whatever'


More information about the Python-Dev mailing list