Call for signatories for J2

Anthony Baxter anthonybaxter at gmail.com
Thu Aug 26 10:44:17 EDT 2004


On Thu, 26 Aug 2004 14:44:27 +0100, Michael Sparks
<michaels at rd.bbc.co.uk> wrote:
> Using proposed J2: (tested)
> class Foo:
>    using:
>       staticmethod
>       eval("(memoise,esiomem)[x==0]")
>    def Hoo(Who, *args):
>       print "Yoo", Who

Why wouldn't you instead write this as:

if x == 0:
   dec = esiomem
else:
   dec = memoise
@staticmethod
@dec
def Hoo(Who, *args):
  ....

Don't use eval unless it's absolutely necessary, _please_.



More information about the Python-list mailing list