At 07:14 AM 2/7/2005, Smith, Jeff wrote:
Alan,

No use beating this dead horse...I guess that's why there are so many
languages in the first place.  Different people are comfortable with
different things.  (I did warn you that I like both Lisp and Prolog and
only wish I had more of a reason to use them :-)

As an aside, I did try to create a lambda based solution but was unable.
Let me know what's wrong:

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

From the docs: lambda arguments: expression print 'a' is not an expression

 File "C:\scratch\Script1.py", line 2
    ftable = { 'a' : lambda: print 'a',
                                 ^
SyntaxError: invalid syntax

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