Um? *boggle* Silly question about listobject.c

Tim Peters tim_one at email.msn.com
Sun Jun 4 00:46:17 EDT 2000


[Courageous]
> So why is it that most/all the list operations
> (for example, list_item) are implemented with
> int and not long? Was it forseen that nobody
> would ever desire to index a list with more than
> maxint entries?

Python was written before ANSI C, and eventually all memory is gotten from
malloc, and that's where the int comes from -- the notion that malloc takes
a size_t argument was introduced with ANSI C.

> Am I missing something or is this a critical
> oversight in the definition of sequences in python?

Critical?  No more than that your experience with more-recent C caused you
to make the similar "critical oversight" of suggesting "long" is adequate.
Guido is on record as favoring changing PyObject_VAR_HEAD to declare ob_size
of type size_t, but that won't happen in time for 1.6.  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>.

mildly-in-favor-of-reality-some-days-ly y'rs  - tim






More information about the Python-list mailing list