On Wed, Oct 4, 2017 at 7:31 AM, ROGER GRAYDON CHRISTMAN <d...@psu.edu> wrote: >>> > for rb in filter (lambda b : b in some_seq, seq): >>> > ... some code that might modify some_seq > I think one must always be very careful about modifying anything > that you are iterating across -- if not avoiding that sort of thing entirely. > In particular, avoid anything that might add or remove elements > in the middle of the sequence.
It isn't, though. That's iterating over seq, and possibly modifying some_seq. So it's safe. ChrisA -- https://mail.python.org/mailman/listinfo/python-list