[Python-Dev] string representation of range in 3.0
Guido van Rossum
guido at python.org
Wed Apr 16 16:57:06 CEST 2008
On Wed, Apr 16, 2008 at 3:15 AM, Armin Rigo <arigo at tunes.org> wrote:
> What about the less confusing and more readily generalizable:
>
> <range object 0, 1, ..., 9>
>
> It would also be helpful IMHO to use this kind of repr for most built-in
> iterators and iterables, instead of their mosty-useless default repr.
We can't do this for iterators, since you can't print the values
without consuming the iterator. Printing something shouldn't have a
side effect on it. But for iterables (e.g. dict views) it should work
fine, and if others can agree with this I'd be happy to accept
patches.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list