[Tutor] Are you allowed to shoot camels? [kinda OT]

Bob Gailer bgailer at alum.rpi.edu
Mon Feb 7 15:47:33 CET 2005

At 07:14 AM 2/7/2005, Smith, Jeff wrote:
>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:bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell 

More information about the Tutor mailing list