On Tue, 20 Nov 2018 at 02:23, Chris Angelico <ros...@gmail.com> 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])
Wouldn't that use the repr, which is *not* changing in this proposal? > In theory, this could actually be made legal, and could be a cool > feature for an enhanced REPL to support. (All you have to do is define > 'range' as a function that checks if it's been given a list, and if > not, passes it on unchanged.) > > Whether this form or the original, I think this would be an improvement. I do like the improved display, but I don't know how useful it would be in practice, given that I don't *often* use raw range objects (as opposed to "for x in range(...)") and the default repr display won't change. I am inclined to think that we're overthinking the problem - changing the str() of a range object is unlikely to break anything, is a small but clear usability improvement, and more time has probably been spent debating whether it's a good idea than it would have cost to just make the change... Paul _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/