[docs] [issue32767] Mutating a list while iterating: clarify the docs

Terry J. Reedy report at bugs.python.org
Fri Feb 9 22:31:54 EST 2018


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Replace 'sequence' with 'collection' and I agree.  The for loop code just calls iter() and it.next() until an exception.  The behavior of it.next for builtins should be documented with the builtins.  (I think there is something already about dict iteration in the dict entry.)

I agree we should say that the list iterator checks the internal index against the current .__len__() on each .next call.  I had not thought about the usefullness of doing that for breadth-first search, so yes, mention that.

----------
nosy: +terry.reedy
versions:  -Python 2.7, Python 3.4, Python 3.6, Python 3.7, Python 3.8

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


More information about the docs mailing list