iters on ints? (reducing the need for range/xrange)

James_Althoff at James_Althoff at
Thu Nov 8 22:58:17 CET 2001

Now that the issue of transfinite cardinals has been fully resolved, isn't
it time for yet another unpopular-and-non-pythonic suggestion?  I believe
it is.

What if (in post-2.2) Python the tp_iter slot in the int type was defined
to return an xrange-like iterator such that one could do the following:

for i in 10:

or, more realistically,

for rowIndex in table.getRowCount():

instead of having to do the range(table.getRowCount()) thingie (or xrange,
if one prefers)?

(Following, here, the lead of the 2.2 mechanism for handling sequences in
for loops, etc.)

Fancy stuff could still be done with "range", of course.

(I never do fancy stuff),


ps. Or we could have another long thread about possible new syntax for

Or, explore ideas on the connection between Python and the continuum

More information about the Python-list mailing list