Efficiency of using long integers to hold bitmaps

Jeff Melvaine jeffm at rivernet.com.au
Sun Jul 10 18:37:21 CEST 2005


I note that I can write expressions like "1 << 100" and the result is stored 
as a long integer, which means it is stored as an integer of arbitrary 
length.  I may need to use a large number of these, and am interested to 
know whether the storage efficiency of long integers is in danger of 
breaking my code if I use too many.  Would I do better to write a class that 
defines bitwise operations on arrays of integers, each integer being assumed 
to contain at most 32 bits?  I cannot find information in the Python manuals 
for 2.4.1 that would allow me to resolve this question; perhaps the 
intention is that programmers should not rely on implementation details.

Thanks in advance,

Jeff 





More information about the Python-list mailing list