when is filter test applied?

Neal Becker ndbecker2 at gmail.com
Tue Oct 3 11:08:39 EDT 2017


In the following code (python3):

for rb in filter (lambda b : b in some_seq, seq):
  ... some code that might modify some_seq

I'm assuming that the test 'b in some_seq' is applied late, at the start of 
each iteration (but it doesn't seem to be working that way in my real code), 
so that if 'some_seq' is modified during a previous iteration the test is 
correctly performed on the latest version of 'some_seq' at the start of each 
iteration.  Is this correct, and is this guaranteed?





More information about the Python-list mailing list