[Python-Dev] Re: PEP 276 Simple Iterator for ints
Skip Montanaro
skip@pobox.com (Skip Montanaro)
Thu, 15 Nov 2001 11:08:19 +0100
>> Below is the first draft of PEP 276 "Simple Iterator for ints".
>> (Available at http://python.sourceforge.net/peps/pep-0276.html)
>>
>> Feel free to comment (positive, negative, bipolar, or in between ;-).
I liked "for i in 10:" at first, however, the more I see of the Haskell
iterator syntax, the more I like it. Given that
* it should cause no backward compatibility issues (you can't put "..."
in a list now, can you? NumPy?)
* it completely replaces range and xrange, not just one use of it
* it can be made to work for floats, strings and possibly other builtin
data types as well as ints
* you can optimize it well
I would tend to view the int-as-iterator as a wart (a neat sort of wart, but
a wart nonetheless), while the Haskell syntax is elegant and seems to fit in
well with existing Python usage.
-1
--
Skip Montanaro (skip@pobox.com - http://www.mojam.com/)
It's only a 25% solution to our problems. Of course, we only want to solve
25% of our problems, so it becomes a 100% solution.