Válas Péter wrote:
2011/6/12 Brett Ritter <swift...@swiftone.org>
Okay fine, so "1024" stored as a number only requires 10 bits (binary
digits) to store,
Actually, 11. :-)
I see your smiley, but actually more than that. Due to the way computers
are designed, numbers are stored in fixed bundles of 8 bits making a
byte. A single byte (8 bits) can store between 0 and 255. So to store
1024, you need two bytes, or 16 bits, not 11.
In practice, that will usually be four bytes, 32 bits, or even eight.
And if you're using Python, where everything is an object, it will
actually be fourteen bytes, or 112 bits:
>>> sys.getsizeof(1024)
14
--
Steven
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor