Question regarding a recent article on informit.com
bens at replytothegroupplease.com
Thu Mar 20 14:33:22 CET 2003
Cameron Laird wrote:
> In article <gpiea.124425$zo2.3268435 at news2.tin.it>,
> Alex Martelli <aleax at aleax.it> wrote:
>> my POV the list comprehension is more elegant, more practical,
>> simpler, more powerful, AND overall far more Pythonic than the
>> jumble of map, lambda and filter you'd have to write in its place --
>> yet I was very strongly attracted to Python even before list
>> comprehensions were
>> added to it, so I can't claim this is the key of the attraction!-)
> ... and, let's repeat, list comprehension isn't anti-functional,
> it's just a style of functional expression (or can be seen as
> such) which happens to be more Pythonic.
Ok, fair points; I probably just misunderstood what Boudewijn had meant
in the first place - the 'functional programming style constructs' may
be discouraged but the functional style will still be possible. Right?
Are there any good tutorials of examples of list comprehension use? In
particular, I'm interested in how to replicate the functionality of
reduce? Map and filter seem easy to do, though.
More information about the Python-list