, Website of Satan

Roy Smith roy at
Fri Jan 14 09:12:45 EST 2005

In article <cs89nd$i6m$1 at>,
 Michael Hoffman < at mh391.invalid> 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 :-)

More information about the Python-list mailing list