replace 'apply' with extended call
russblau at hotmail.com
Mon Oct 25 16:35:02 CEST 2004
"Alan G Isaac" <aisaac at american.edu> wrote in message
news:10nq30jij1nm41a at corp.supernews.com...
> This raises another (newbie) question that I had.
> Take a trivial example:
> from operator import truth
> bool1 = lambda lst: map(truth, lst)
> def bool2(lst): return map(truth,lst)
> def bool3(lst): return [truth(_) for _ in lst]
> To my eyes, the most natural is bool2.
> I would never have considered bool1 if
> I had not come across it in the Merz book,
> but it is both shortest and clear.
> I include bool3 just for comparison: I think
> the way in which it is harder to read illustrates
> the usefulness of 'map'.
You find bool3 *harder* to read? I guess that just illustrates what a
wonderfully diverse world we live in.
I don't actually read my hotmail account, but you can replace hotmail with
excite if you really want to reach me.
More information about the Python-list