It wasn't clear to me what you are proposing:
iter(an_int)
to return.
There have been multiple proposal in the past for it to return the same thing as:
iter(range(an_int)),
so that one could write:
for i in 23:
...
more compactly than:
for i in range(23):
...
but that proposal has been rejected many times.
On the other hand, maybe you are proposing that:
iter(5)
Should return the same thing as:
iter((5,))
which is really odd. It makes some small amount of sense if you assume that all sequences are "flat". But even then, the distinction between a single item and a sequence with one item in it a critical distinction that should not be masked.
Also - if you do this for integers, do you do it for all numbers? what about any other single object? (and THAT would get really strange with strings!)
BTW: I'm using `iter` here because that is the iteration protocol -- anything we do needs to conform to that.
- CHB
Christopher Barker, PhD (Chris)
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython