[Python-Dev] PEP 276 (simple iterator for ints)

Josiah Carlson jcarlson at uci.edu
Wed Jun 30 16:50:38 EDT 2004

> Interesting. I suppose that could be added as an extra argument
> against those who claim that [0,1,2,3,4,5] is *NOT* the sequence
> of integers "obviously" associated with the number 6. As for me,
> even before I started using Python I had already become convinced
> of that.
> PEP 276 is worth a second look. In fact, it's trivial to
> implement, and what it REALLY needs is a champion to bring it up
> with the BDFL (and others).
[snip example]
> is simple and elegant. And while at first glance it seems like
> allowing iteration over ints would open up all kinds of subtle
> bugs, I find that the PEP does a good job of arguing that it
> doesn't.

While PEP 276 attempts to make easier the most common iteration over
integers (half open, 0...n-1), PEP 284 takes care of general iteration
over integers (a...b, for arbitrary integer a and b, incrementing or
decrementing as necessary).

In this case, does practicality (usable for more integer iteration
scenarios) outweigh the purity (integer fields/list indices)?

 - Josiah

More information about the Python-Dev mailing list