[pypy-dev] Arrays in rpython
Maciej Fijalkowski
fijall at gmail.com
Tue Jun 7 08:40:49 CEST 2011
On Mon, Jun 6, 2011 at 8:54 PM, Timothy Baldridge <tbaldridge at gmail.com> wrote:
>> In case you don't already know: in Python (and RPython), lists are
>> implemented as
>> resizeable arrays, i.e. they look more like a C++ std::vector and not
>> a std::list.
>>
>> This said, IIRC RPython has special code for fixed-size lists.
>> I think you just have to avoid all resizing functions.
>> This means that the list must be created with statements like
>> array_of_ints = [0] * 32
>> array_of_objects = [None] * 32
>
>
> Excellent! Exactly what I was looking for. Thanks.
>
> Timothy
>
There is also pypy.rlib.debug.make_sure_not_resized which would make
annotation explode if you by chance resize this list.
More information about the pypy-dev
mailing list