[issue35200] Range repr could be better

Julien Palard report at bugs.python.org
Fri Nov 9 11:25:51 EST 2018


New submission from Julien Palard <julien+python at palard.fr>:

This morning I was teaching Python (again and again), and again I was thinking we could do better about the representation of ranges.

Typically in the current repr of ranges we do not see that the end is excluded:

>>> range(10)
range(0, 10)

However it has the (little?) benefit of respecting the "repr gives valid Python".

I propose to change it to:

>>> range(10)
<range object [0, 1, ..., 8, 9]>

----------
messages: 329531
nosy: mdk
priority: normal
severity: normal
status: open
title: Range repr could be better
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35200>
_______________________________________


More information about the Python-bugs-list mailing list