[issue35200] Range repr could be better
Nick Coghlan
report at bugs.python.org
Sun Nov 11 03:55:32 EST 2018
Nick Coghlan <ncoghlan at gmail.com> added the comment:
I agree with Steven and Raymond on this one: changing __repr__ on ranges in a way that breaks round-tripping through eval would be problematic, especially as I'd expect that to be an issue in doctests as well.
However, I also like the idea of having easier access to a more list-like representation that shows the actual range endpoints, not just the inputs used to calculate them, and like Steven, I'm more comfortable with changing __str__ than I am with changing __repr__.
That would give:
>>> range(10)
range(0, 10)
>>> print(range(10))
<range object: [0, 1, ..., 8, 9]>
----------
nosy: +ncoghlan
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35200>
_______________________________________
More information about the Python-bugs-list
mailing list