[Python-Dev] string representation of range in 3.0

Guido van Rossum guido at python.org
Wed Apr 16 00:12:52 CEST 2008

That's why I proposed <0, 1, ..., 9> for repr(range(10)). (And I meant
the '...' literally, i.e. if there are more than 4 values, replace all
but the first two and the last with three dots. And yes, I mean that
str(range(4)) == '<0, 1, 2, 3>' but str(range(5)) == '<0, 1, ..., 4>'.

I'm not at all sure that we should go the same way for dict views
though. They are quite different beasts -- the fact that they change
depending on the underlying dict ought to be somehow emphasized, and
I'd be happier to keep these as they are in 3.0a4.


On Tue, Apr 15, 2008 at 2:53 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Brad Miller wrote:
>  > It was suggested that a broader discussion might be in order around the
>  > issue of iterators and how they are displayed in the command line
>  > interpreter.
>  Whatever is done, I don't think it would be a good idea
>  to make the str() of these things look *too* much like
>  a list. I think that would make things more confusing
>  for a newcomer rather than less.
>  The way they are, at least it's obvious that they're
>  something special.
>  --
>  Greg
> _______________________________________________
>  Python-Dev mailing list
>  Python-Dev at python.org
>  http://mail.python.org/mailman/listinfo/python-dev
>  Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list