Ammar Askar <am...@ammaraskar.com> added the comment:
Modifying containers while iterating over them is generally not safe. In this case the iterator at the point you start the loop will contain all the items to iterate over, adding them mid-loop will not cause them to be iterated over. Take a look at the last section here for suggestions: https://docs.python.org/3/tutorial/datastructures.html#looping-techniques ---------- nosy: +ammar2 resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35023> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com