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

Smith, Jeff jsmith at medplus.com
Tue Feb 8 14:37:31 CET 2005


Alan, 

That's no good.  You still get something printed out.  In this case:

None

Jeff

-----Original Message-----
From: Alan Gauld [mailto:alan.gauld at freenet.co.uk] 
Sent: Monday, February 07, 2005 6:15 PM
To: Smith, Jeff; Bob Gailer; tutor at python.org
Subject: Re: [Tutor] Are you allowed to shoot camels? [kinda OT]


That's actually worse than you might think.  Try this:

> def p(): pass
> ftable = { 'a' : lambda: 'a',
>           'd' : lambda: p}

That should be:

           'd': p}

ie No lambda used at all.

I wish Python had real lambdas!

> And what you get is:
> <function p at 0x009BDFB0>

Yep, coz the lambda returns a function object!
Which it should, I just shouldn't have used lambda there.

My bad,

Alan G.


More information about the Tutor mailing list