need code to gen all bit possibilities for 64 bits

Tim Roberts timr at probo.com
Sun Jun 3 06:21:28 CEST 2001


grante at visi.com (Grant Edwards) wrote:

>In article <serbhtsuij5m0mpsib1tvksrpemcpcceic at 4ax.com>, Tim Roberts wrote:
>
>>
>>The easiest way to generate all possible 64-bit patterns is to count:
>>
>>i = 0L
>>while i < (2L ** 64L): print i
>>
>>Printing 18 quintillion numbers is going to take a very, very, VERY long
>>time.  At one per microsecond, I get about 500,000 years.
>
>I think the while loop above is going to run longer than
>500,000 years.  :)

Whoops.  I started out using xrange, but I wasn't convinced it would handle
longs.  That's what I get for being a smart aleck.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list