Re: [Python-ideas] Enhancing range object string displays

2018-11-20 Thread Paul Moore
On Tue, 20 Nov 2018 at 02:23, Chris Angelico wrote: > I'm a fairly experienced Python programmer, and I still just fire up a > REPL to confirm certain uses of range() with steps. > > What would it be like if the string form looked like this: > > >>> range(1, 30, 3) > range([1, 4, 7, ..., 25, 28])

Re: [Python-ideas] Enhancing range object string displays

2018-11-19 Thread Nathaniel Smith
On Mon, Nov 19, 2018 at 6:09 PM Steven D'Aprano wrote: > > On Mon, Nov 19, 2018 at 05:09:25PM -0800, danish bluecheese wrote: > > I think it is kind of useless effort. If somebody using range() then > > probably knows about it. > > For experienced users, sure, but this is an enhancement to help >

Re: [Python-ideas] Enhancing range object string displays

2018-11-19 Thread Chris Angelico
On Tue, Nov 20, 2018 at 1:10 PM Steven D'Aprano wrote: > > On Mon, Nov 19, 2018 at 05:09:25PM -0800, danish bluecheese wrote: > > I think it is kind of useless effort. If somebody using range() then > > probably knows about it. > > For experienced users, sure, but this is an enhancement to help >

Re: [Python-ideas] Enhancing range object string displays

2018-11-19 Thread MRAB
On 2018-11-20 00:19, Steven D'Aprano wrote: On the bug tracker, there is a proposal to enhance range objects so that printing them will display a snapshot of the values included, including the end points. For example: print(range(10)) currently displays "range(10)". The proposal is for the __st

Re: [Python-ideas] Enhancing range object string displays

2018-11-19 Thread Steven D'Aprano
On Mon, Nov 19, 2018 at 05:09:25PM -0800, danish bluecheese wrote: > I think it is kind of useless effort. If somebody using range() then > probably knows about it. For experienced users, sure, but this is an enhancement to help beginners who may be confused by the half-open end points. Even non

Re: [Python-ideas] Enhancing range object string displays

2018-11-19 Thread danish bluecheese
I think it is kind of useless effort. If somebody using range() then probably knows about it. Also there are some workarounds inspect range() result already. Like: *range(10) or if it is big: *range(1000)[:10] On Mon, Nov 19, 2018 at 4:25 PM Steven D'Aprano wrote: > On the bug tracker, there

[Python-ideas] Enhancing range object string displays

2018-11-19 Thread Steven D'Aprano
On the bug tracker, there is a proposal to enhance range objects so that printing them will display a snapshot of the values included, including the end points. For example: print(range(10)) currently displays "range(10)". The proposal is for the __str__ method to instead return "". https://b