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

2018-02-10 Thread Tim Peters
Tim Peters added the comment: Stefan, yup! Thank you. `array.array` and `bytearray` iterators appear to work the same way as `list` iterators here. Terry, the note in the `for` statement docs was written before there _was_ an iterator protocol. For example, here are the

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

2018-02-10 Thread Xavier G. Domingo
Change by Xavier G. Domingo : -- nosy: +xgdomingo ___ Python tracker ___ ___

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

2018-02-09 Thread Terry J. Reedy
Terry J. Reedy 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

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

2018-02-07 Thread Stefan Pochmann
Stefan Pochmann added the comment: And `bytearray`. -- ___ Python tracker ___

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

2018-02-06 Thread Stefan Pochmann
Stefan Pochmann added the comment: Yes, there's also `array.array`. -- nosy: +Stefan Pochmann ___ Python tracker ___

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

2018-02-05 Thread Tim Peters
Tim Peters added the comment: Some other points to consider: I don't think this belongs in the `for` statement docs at all. Instead they should merely _note_ that what happens if a sequence being iterated over is mutated is up to the sequence iterator. Then, e.g., the

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

2018-02-04 Thread Tim Peters
New submission from Tim Peters : This has come up repeatedly, and the docs should be updated to resolve it: https://stackoverflow.com/questions/48603998/python-iterating-over-a-list-but-i-want-to-add-to-that-list-while-in-the-loop/48604036#48604036 Seemingly the only relevant