[Tutor] Are you allowed to shoot camels? [kinda OT]
Smith, Jeff
jsmith at medplus.com
Mon Feb 7 15:43:07 CET 2005
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...
Jeff
-----Original Message-----
From: Bob Gailer [mailto:bgailer at alum.rpi.edu]
Sent: Monday, February 07, 2005 9:48 AM
To: Smith, Jeff; tutor at python.org
Subject: RE: [Tutor] Are you allowed to shoot camels? [kinda OT]
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:bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell
More information about the Tutor
mailing list