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

Alan Gauld alan.gauld at freenet.co.uk
Tue Feb 8 00:15:23 CET 2005


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