Python Tutorial Was: Guido's regrets: filter and map
Matthew Knepley
knepley at mcs.anl.gov
Tue Nov 26 13:54:06 EST 2002
>>>>> ">" == Jeremy Fincher <tweedgeezer at hotmail.com> writes:
>> Thomas Guettler <pan-newsreader at thomas-guettler.de> wrote in message
>> news:<pan.2002.11.24.08.05.38.521605.727 at thomas-guettler.de>... I never liked filter, map and reduce.
>>
>> I think it would be good to remove them from the python tutorial. I think the tutorial would be easier for newbies
>> it it would be smaller.
>> The biggest problem with filter, map, and reduce is that they're functions, not methods. All this discussion about
>> list comprehensions versus filter/map ignores one major disadvantage of list comprehensions: that they only work
>> with lists. If filter/map/reduce had been *methods* on list objects, then a programmer could implement his own
>> container objects (binary trees, subclasses of list, etc.) with their own filter/map/reduce methods to construct
>> like containers, and people would be happier.
Actually, wouldn't you expect (as in most functional languages) that these methods are
polymorphic over the shape of the argument? I think that the functional paradigm is
just unfamiliar to a great number of Python programmers. That is not a reason to jettison
very useful functions from the language. Many systems have mixed programming paradigms, e.g.
Mathematica.
Matt
>> As far as the tutorial goes, filter/map/reduce could be "discovered" just like the rest of the methods that aren't
>> emphasized in the tutorial.
>> Jeremy
--
"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness
More information about the Python-list
mailing list