Let's Talk About Lambda Functions!
Carl Banks
imbosol at vt.edu
Fri Jul 26 18:59:18 EDT 2002
Alex Martelli wrote:
> Robb Shecter wrote:
>
>> But to really answer you - I like lambdas and think lambdas can add
>> clarity because their scope directly reflects their 'scope'. (Make
>> sense?)
>
> Sorry, not to me. Take a typical bug sometimes posted here, such as:
>
> for word in 'fee fie foo fum'.split():
> Button(frame, command=lambda: print word)
>
> The poster is typically nonplusses that all buttons print 'fum'.
I imagine it's more likely that the poster would be nonplussed that it
produced a syntax error. :)
--
CARL BANKS
http://www.aerojockey.com
More information about the Python-list
mailing list