what if i dont want a 32 bit int?
Gordon McMillan
gmcm at hypernet.com
Tue Jan 4 21:58:09 EST 2000
More information about the Python-list mailing list
Tue Jan 4 21:58:09 EST 2000
- Previous message (by thread): what if i dont want a 32 bit int?
- Next message (by thread): pythonwin installation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
jerry smith asks: > what if all i want is really just an 8 bit or 16 bit number? so > if i do this > > i=0x80 > i=~i > print '%x' %i > ffffff7f > > that is too many leading f's so i have to have an anding mask of > i & ff? is there any alternative? Nope. > to select how much space i want > to dedicate for a python object to be stored as? You think a Python int only takes 32 bits? Sorry to disappoint, but they're objects(*). Now if you want to store them externally as something else, you can use the struct module to get them into or from C values. (*) The first 100 ints are singleton objects: >>> x = 1 >>> import sys >>> sys.getrefcount(x) 40 - Gordon
- Previous message (by thread): what if i dont want a 32 bit int?
- Next message (by thread): pythonwin installation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list