Nick Coghlan <ncogh...@gmail.com> added the comment:

(Retitled the issue to better reflect the underlying feature request)

As Steven describes, there are enough problems with changing range.__repr__ 
that if that's the proposal, then the only possible answer is "No", and closing 
the issue.

However, changing range.__str__ (and hence print, f-strings, logging, and more) 
offers many of the same benefits, without most of the downsides (repr will 
still roundtrip through eval, doctests won't break, etc).

The only potential benefit that gets lost is the fact that entering "range(10)" 
at the REPL will still print "range(0, 10)", such that you need to do 
"print(range(10))" to get the version that shows the endpoint values. For 
longer ranges, "print(range(100))" will still end up being a lot more user 
friendly than "print(list(100))".

----------
title: Range repr could be better -> Make the half-open range behaviour easier 
to teach

_______________________________________
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

Reply via email to