Actually, there is also a module by name "Array"

import array

t=array.array(I,size)

Here t is a list and constrained more as an integer array.

Check docs for more help.

Thx.
Santhosh

On 6/7/11, Maciej Fijalkowski <[email protected]> wrote:
> On Mon, Jun 6, 2011 at 8:54 PM, Timothy Baldridge <[email protected]>
> 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.
> _______________________________________________
> pypy-dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/pypy-dev
>
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to