[issue33681] itertools.groupby() returned igroup is only callable once

Steven D'Aprano report at bugs.python.org
Tue May 29 08:12:54 EDT 2018


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

This is standard behaviour for all iterators. Once you have iterated over them once, they are consumed, and iterating over them again returns nothing:

py> it = iter("abc")
py> print(list(it))
['a', 'b', 'c']
py> print(list(it))
[]

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

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


More information about the Python-bugs-list mailing list