[issue41030] Provide toList() method on iterators/generators (`list()` is a flow killer in REPL)

Rémi Lapeyre report at bugs.python.org
Fri Jun 19 05:20:42 EDT 2020


Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:

It would not work, an iterator is just a thing that has __next__() and __iter__():


class MyIterator:
    def __iter__(self): return self
    def __next__(self): return 1


Plenty of iterators would not have this method even if we added it to some of them in the standard library and you would be event more frustated that sometimes toList(), and sometimes doesn't.



If you need to move in the current line in the REPL you can use Ctrl-a and Ctrl-e and you can use Ctrl + arrow in a Jupyter Notebook.

----------
nosy: +remi.lapeyre

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41030>
_______________________________________


More information about the Python-bugs-list mailing list