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(10000000)[:10]
On Mon, Nov 19, 2018 at 4:25 PM Steven D'Aprano <st...@pearwood.info> 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 __str__ method > to instead return "<range object [0, 1, ..., 8, 9]>". > > https://bugs.python.org/issue35200 > > print(range(2, 200, 3)) would display > > <range object [2, 5, ..., 194, 197]> > > Note that the original proposal was for range objects' __repr__ to > display this behaviour. But given the loss of eval(repr(obj)) round > tripping, and the risk of breaking backwards compatibility, it was > decided that isn't acceptable but using the same display for __str__ > (and hence produced by print) would be nearly as useful but without the > downsides. > > The developer who proposed the feature, Julien, now wants to reject the > feature request. I think it is still a useful feature for range objects. > What do others think? Is this worth re-opening? > > > > -- > Steve > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/