lemming wrote:
>> Python page could start with: "You like 'map', 'filter', 'for x in ...'
>> and lambda's in Python? Then you will like to learn where Python has
What about "iterators" - lazy lists - and "generators" - lazy
function definitions. And list comprehensions, both lazy
and strict. And zip. And the "itertools" module - containing
analogues for lazy ++, [n..], cycle, dropWhile, groupBy, zipWith,
takeWhile, etc. All inspired by Haskell.
Jerzy Karczmarczuk wrote:
> Henning, Python *may not* start in such a way. Those functionals are
> being obsoletised by Guido Van Rossum. "for" remains,
All of them are remaining. Guido's effort to deprecate
them brought down a storm of protest. Folds, known as "reduce"
in Python, are on their way out, though. They scared
people (not "Pythonic").
> please, don't try to convince anybody that Haskell was the first language
> with iterators...
Python's "iterators" are not the same as iterators in C
and other older languages. They are lazy lists. The reason
they named them "iterators" is not to scare people.
Haskell was not the first to have lazy lists, but Haskell
was an important part of the inspiration for introducing
them into Python.
Guido was forced to do something - someone had written
a new Python interpreter, called "Stackless Python",
in which every Python function was a Scheme-like continuation.
People found this very, very scary. So Guido stopped
it by introducing laziness, which could be made much
less scary.
-Yitz