> That's kinda what I thought but a couple of people suggested 
> that I used lambdas to make it clearer 

I suggested that if we had proper lambdas we could use 'em...

But of course you can still use lambdas just put the print 
at the client side:

def p(): pass
ftable = { 'a' : lambda: 'a',
           'b' : lambda: 'b or c',
           'c' : lambda: 'b or c',
           'd' : lambda: p}
print ftable.get(var, lambda: 'default case')()

But I still had to use a def for the pass... :-(

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to