Steve Holden <[EMAIL PROTECTED]> writes:
[...]
> You are modifying the list as you iterate over it. Instead, iterate
> over a copy by using:
> 
> for ip in ips[:]:
>    ...

Just to help popularise the alternative idiom, which IMO is
significantly less cryptic (sane constructors of mutable objects
almost always make a copy, and list is no exception: it's guaranteed
to do so):

for ip in list(ips):
   ...


Works back to at least Python 1.5.2.


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

Reply via email to