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

Kent Johnson kent37 at tds.net
Mon Feb 7 16:16:12 CET 2005

Bob Gailer wrote:
> 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

As a workaround to use print in a lambda you can use sys.stdout.write() instead.


More information about the Tutor mailing list