[issue2610] string representation of range

Alexander Belopolsky report at bugs.python.org
Fri Apr 11 16:18:59 CEST 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

-1

I don't think <0, 1, ..., 9> is much clearer than range(0, 10).  The 
only problem students may have is that 10 not in range(0, 10), but this 
can be learned very quickly.  The <..> repr breaks x == eval(repr(x)) 
invariant which is actually important in some of my code. Furthermore, 
the proposed <..> representation suggests that the range object contains 
the integers, which is not true.  While eval/repr round-tripping may not 
be important for the majority of applications, it is a nice feature for 
any interactive work including education.  Finally, I think introducing 
students to list(range(..))/tuple(range(..)) idioms early is a good 
thing. The sooner they learn that list/tuple are real containers while 
ranges, dict key/values etc. are not the better.

----------
nosy: +belopolsky

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2610>
__________________________________


More information about the Python-bugs-list mailing list