
Jerzy Karczmarczuk wrote:
...don't forget that itertools have been introduced in the version 2.3! ...But we were speaking about map and filter, and this is 1994... So, perhaps some concrete references - if given - should be tested against the historical truth.
OK, OK. You want to make me work. In May 1994, there was the following post by Ken Manheimer in which he praises the functional features of Python: http://www.python.org/search/hypermail/python-1994q2/0698.html That invoked the famous response by Guido in which he regrets having introduced some of those features: http://www.python.org/search/hypermail/python-1994q2/0705.html Here are some excerpts: "Really, I don't understand all the fuzz about lambda, and I don't see why its introduction made functions any more first class than they already were in Python... Also notice that Python's map, filter and reduce are quite powerless compared to the same functions in the average functional programming system -- they don't work when applied to infinite sequences since they use eager evaluation." Can we guess which "average functional programming system" he was thinking of? Hint: it uses lazy evaluation. Guido is clearly not rejecting functional influences on Python, he is supporting them. But he feels that these specific instances do not fit in. The thread then continues with a wide-ranging discussion of functional versus imperative programming, including CPS style (intertwined with the original topic, which was Python's layout vs. C-style blocks, where Haskell is also mentioned). This discussion makes it clear that all those who worked on Python at that time were well-aware of what was happening in the functional world, and that this was an important influence on their thinking about Python. Haskell is mentioned by name in the following post by Steven D. Majewski: http://www.python.org/search/hypermail/python-1994q2/0718.html where Haskell is portrayed as taking one paradigm to the extreme, as opposed to Python in which all can be represented. Implying that, in particular, Python must include features from the Haskell paradigm as well. (At that time, I was busy programming in Perl, C++ and other languages, having never heard of either Python or Haskell.) Towards the end of the decade, there were more discussions about adding Haskell features into Python. Several were implemented starting in 2000: "PEP 201 - Lockstep Iteration... Created: 13-Jul-2000... This PEP proposes a standard way of performing such iterations by introducing a new builtin function called `zip'... The function's name... the BDFL strongly prefers zip() due to its Haskell[2] heritage." http://www.python.org/dev/peps/pep-0201/ "What's New in Python 2.0... released on October 16, 2000... The idea of list comprehensions originally comes from the functional programming language Haskell... discussed for a seemingly endless time on the python-dev mailing list." http://www.python.org/download/releases/2.0/new-python.htm Note that after the introduction of list comprehensions - explicitly from Haskell - Guido's argument against lambdas, maps, and folds changed a bit. In the blog post you referenced, his argument is that one should use list comprehensions instead. So that is not exactly a rejection of Haskell influence. Iterators, generators, and itertools we have discussed. Recent additions to Python include partial function application (of sorts), type inference (of sorts), and a "numeric prelude" (of sorts), described in PEPs 309, 3124, and 3141 respectively, all mentioning Haskell by name. Regards, Yitz