Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
On Sun, Nov 18, 2018 at 09:43:02PM +0000, Julien Palard wrote: > My first though went to giving something really simple like: > > >>> print(range(10)) > 1, 2, ..., 8, 9 -1 Surely that would be your *second* thought, since you already had a perfectly adequate first thought: <range object [1, 2, ..., 8, 9]> is explicit about what kind of object we have. Remember, there will be times where people don't know they have a range object, and are printing it to find out what they have. Let's just move that from __repr__ to __str__. > But for the empty range it would give an empty string. It may make > sense, but may also be surprising. > > The other way would be to print [1, 2, ..., 8. 9], so the empty range gets [] > instead of nothing. Certainly not. That looks like a list containing 1, 2, ellipsis, 8, 9, and will only increase confusion about the difference between lists and range objects. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35200> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com