Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

As a teacher, I think the proposal makes us worst off.  It is far easier and 
more useful at the interactive prompt to use list() rather than print() to show 
ranges:

    >>> list(range(10))
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    >>> list(range(2, 10))
    [2, 3, 4, 5, 6, 7, 8, 9]
    >>> list(range(2, 10, 3))
    [2, 5, 8]

If you do the same thing with print(), it takes an additional character 
("print" vs "list"), it creates a new source of confusion (str vs repr), and it 
doesn't generalize to other iterators like enumerate(), reversed(), and 
generators.

Also, the various ideas listed for a possible new __str__ are all awkward or 
mysterious for some inputs (empty ranges, short ranges, etc).

FWIW, I teach this topic every week.  Presenting with list(range(...)) is less 
convenient than with the Python 2.7 version, but it works out just fine in 
practice and nicely sets the stage for covering set(iterable), tuple(iterable), 
dict.fromkeys(iterable), etc.

I'm opposed the this proposal because I think it will create more teaching 
difficulties than it solves.

----------

_______________________________________
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