Question regarding a recent article on informit.com

Alex Martelli aleax at aleax.it
Thu Mar 20 07:23:40 EST 2003


Ben S wrote:

> Jp Calderone wrote:
>>   Guido has always frowned on the functional elements of Python.
> 
> Why is this? Personally I would have thought that the functional
> elements of Python are an important part of what distinguishes it from
> being a slightly cleaner version of BASIC? It seems like a lot of sample
> code I see here and elsewhere uses map, filter, reduce, and lambda, so
> I'd assumed that these features were a significant part of what
> attracted people to Python. Maybe I'm wrong? (I'm not exactly an expert
> in this language.)

What attracts people to Python differs -- but the careful balance
of elegance and pragmaticity, simplicity and power, high level of
abstraction yet ease of access to the lower levels at need, is hardly
affected if one chooses to write, e.g., [x+23 for x in seq if x>0] instead
of map(lambda x: x+23, filter(lambda x: x>0, seq)), is it now?  From
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!-)


Alex





More information about the Python-list mailing list