PEP 276 Simple Iterator for ints

Skip Montanaro skip at
Thu Nov 15 11:08:19 CET 2001

    >> Below is the first draft of PEP 276 "Simple Iterator for ints".
    >> (Available at
    >> 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.


Skip Montanaro (skip at -
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.

More information about the Python-list mailing list