At 07:43 AM 2/7/2005, Smith, Jeff wrote:
That's kinda what I thought but a couple of people suggested that I used
lambdas to make it clearer that I figured I was doing something wrong...

Well you can use lambdas. Have them return an expression which you print after retrieving:
ftable = { 'a' : lambda: 'a',
'b' : lambda: 'b or c',
'c' : lambda: 'b or c',
'd' : lambda: ''}
print ftable.get(var, lambda: 'default case')()


But it would be clearer to store just the expressions:
ftable = { 'a' : 'a',
            'b' : 'b or c',
            'c' : 'b or c',
            'd' : ''}
print ftable.get(var, 'default case')


Bob Gailer
mailto:[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell


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

Reply via email to