Call for signatories for J2

Michael Sparks michaels at
Thu Aug 26 15:44:27 CEST 2004

Pierre-Frédéric Caillaud wrote:

> Can we insert conditional expressions in the decorator list ?

Not directly, but yes. Both J2 and A1 are "limited" to putting just
values that resolve to a function in the decorator list. In practice
this means that if you REALLY want to do things like conditional
expressions you can:

def memoise(f):
   print "memoise"
   return f

def esiomem(f):
   print "esiomem"
   return f

Using current syntax: (untested)

class Foo:
   def Hoo(Who, *args):
      print "Yoo", Who

Using proposed J2: (tested)
class Foo:
   def Hoo(Who, *args):
      print "Yoo", Who

Personally that strikes me as relatively evil, but it works.


Michael.Sparks at    
British Broadcasting Corporation, Research and Development
Kingswood Warren, Surrey KT20 6NP

This message (and any attachments) may contain personal views
which are not the views of the BBC unless specifically stated.

More information about the Python-list mailing list