Astan Chee <[EMAIL PROTECTED]> writes on Sat, 19 Aug 2006 03:34:26 +1000:
>  >>> for p in ps:
>     if p in qs:
>         ps.remove(p)

You are modifying an object ("ps") while you iterate over it.
This is a receipe for surprises...

The standard idiom is to iterate over a copy rather than the object itself:

        for p in ps[:]:
          ....


Dieter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to