Tim Chase wrote:

success = None
for i in range(5):
    #Try to fetch public IP
    success = CheckIP()
    if success:
        break
if not success:
    print "Exiting."
    sys.exit()

Though a bit of an abuse, you can use

  if not any(CheckIP() for _ in range(5)):
    print "Exiting"
    sys.exit()

I don't see why you speak of abuse, bit of abuse would be, say if you replaced range(5) by '12345' to win a char; but otoh I think you misspelled any() for all().

Cheers BB

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

Reply via email to