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
I don't know that that approach is less cryptic. ips is already a list... it looks cryptic to make it a list again, doesn't it? IMO, the two are equally cryptic. The epitome of clarity would be copy(ips)... now *that* makes sense, of course, ips[:] or list(ips) work equally well to the programmer who has learned them.
--
http://mail.python.org/mailman/listinfo/python-list