osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

when is filter test applied?


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?