This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients mdk, ncoghlan, rhettinger, seluj78, serhiy.storchaka, steven.daprano
Date 2018-11-18.21:57:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20181118215701.GA11582@ando.pearwood.info>
In-reply-to <1542577382.84.0.788709270274.issue35200@psf.upfronthosting.co.za>
Content
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.
History
Date User Action Args
2018-11-18 21:57:08steven.dapranosetrecipients: + steven.daprano, rhettinger, ncoghlan, serhiy.storchaka, mdk, seluj78
2018-11-18 21:57:08steven.dapranolinkissue35200 messages
2018-11-18 21:57:07steven.dapranocreate