Um? *boggle* Silly question about listobject.c

Tim Peters tim_one at email.msn.com
Sun Jun 4 16:58:54 EDT 2000


[Tim]
> ... In the meantime, if you really need lists with more than 2
> billion elements, your hardware budget is so large you can afford
> to pay someone to patch you up a custom Python <wink>.

[Marc Christiansen]
> What makes you sure, that sizeof(int)==4?

How tedious do you want to make this?  In point of fact, sizeof(int) may be
1 in ANSI C, and still allow expressing 2 billion non-negative values.  The
std only guarantees that an int can hold a value at least as large as could
be held in a 2-byte 2's-comp integer on a machine where a byte is 8 bits (in
particular, it does not guarantee that sizeof(int) >= 2, or that the units
returned by sizeof represent 8 bits each).

If we're done being tedious now <wink>, my *observation* is that an int is
large enough to express at least 2**31 billion non-negative values on every
platform Python runs on.  It has certainly been ported to platforms where
ints are much larger than that, but AFAIK never to a platform where ints are
smaller than that.  If one such pops up, I'll refer porting questions to you
<wink>.

there's-a-reason-most-people-don't-read-stds-ly y'rs  - tim






More information about the Python-list mailing list