In article <[EMAIL PROTECTED]>, Michael Hoffman <[EMAIL PROTECTED]> wrote:
> Peter Renzland wrote: > > What is the simplest/fastest Python program to determine how many > > IP addresses sum up to 666? > > > > The simplest/fastest enumerator? > > > > The simplest/fastest that determines which ones of them are home pages? > > This seems to work although it could be made more efficient or elegant. > Also, the failed gethostbyaddr() calls take forever. > > from socket import gethostbyaddr, herror > > for a in xrange(256): > if a < 666-255*3: > continue I'm not sure what you meant to do, but note that 'a < 666-255*3' is false for all values of 'a' generated by the xrange() call. Removing that test would make the code more efficient. Hard to say if it would make it more elegant :-) -- http://mail.python.org/mailman/listinfo/python-list