PEP 276 Simple Iterator for ints (fwd)

James_Althoff at i2.com James_Althoff at i2.com
Wed Nov 28 14:07:04 EST 2001


Fernando Perez wrote:
>well, while on the topic why not go for full math notation?
>for i in [0,1,..,5), (0,1,..,5], etc.
>
>That would satisfy all math options for semi-open, semi-closed
>intervals, and send every brace-matching text editor on the face of
>this planet into a fit :-)
>
>I get a feeling this PEP isn't going to get too far...

Just another reminder for those who haven't followed the entire thread (or
perhaps didn't read the PEP ;-)

... Although PEP 276 has stimulated much interesting discussion about new
syntax for specifying integer intervals, PEP 276 itself does not call for
any such syntactic changes to Python.  It (merely) suggests adding an
*iterator* to types.IntType (using stuff that is already fully supported in
Python 2.1) to make more convenient the common case of using an index to
access items in a sequence (in a for-loop) when direct access to said items
is not practical (as in the case of a multi-dimensional table, for
example).

Jim





More information about the Python-list mailing list