You are modifying the list as you iterate over it. Instead, iterate over a copy by using:
for ip in ips[:]: ...
Also worth noting, you can write this like:
for ip in list(ips): ...
if you're afraid of smiley-faces [:] in your code. ;)
Steve -- http://mail.python.org/mailman/listinfo/python-list