[issue42003] After changing to list or tuple, will the original parameter change?

Steven D'Aprano report at bugs.python.org
Sat Oct 10 22:07:20 EDT 2020


Steven D'Aprano <steve+python at pearwood.info> added the comment:

This is not a bug. In Python 2, zip() returns a list, so you can use it over and over again. But in Python 3, zip() returns an iterator, and you can only use iterators once. After you have used the iterator, it is exhausted and there is nothing left.

So the behaviour you see is expected and intentional.

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list