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

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Jun 30 22:17:15 EDT 2004

"Chermside, Michael" <mchermside at ingdirect.com>:

>     >>> for i in len(myList):
>     ...     doSomethingWithIndexes(i)
> is simple and elegant.

IMO it would be clearer, and equally elegant, to write
this as something like

  for i in indices(myList):

which is easily accomplished with the aid of a suitable
definition for indices(). No language changes needed.

I suspect most people other than number theorists would
find the concept of a set of integers being contained
in another integer quite wierd.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list