[issue6762] strange string representation of xrange in print

Eric Smith report at bugs.python.org
Sat Aug 22 21:48:01 CEST 2009


Eric Smith <eric at trueblade.com> added the comment:

For types where it's possible, the str or repr returns a string that can
be passed to eval:

>>> for i in eval(str(xrange(5))):
...   print i
... 
0
1
2
3
4

xrange (and list, and tuple, and others) fall into this category.

----------
nosy: +eric.smith
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6762>
_______________________________________


More information about the Python-bugs-list mailing list