Re: [pypy-dev] Arrays in rpython

2011-06-08 Thread Carl Friedrich Bolz
On 06/07/2011 06:03 PM, Amaury Forgeot d'Arc wrote: 2011/6/7 Santhosh Edukulla: Actually, there is also a module by name "Array" import array t=array.array(I,size) But is this allowed in RPython code? no, it is not. Cheers, Carl Friedrich ___ py

Re: [pypy-dev] Arrays in rpython

2011-06-07 Thread Timothy Baldridge
>> Actually, there is also a module by name "Array" >> >> import array >> t=array.array(I,size) And if you notice, it doesn't support arrays of objects, which was what my original problem was Timothy ___ pypy-dev mailing list pypy-dev@python.org http://

Re: [pypy-dev] Arrays in rpython

2011-06-07 Thread Amaury Forgeot d'Arc
2011/6/7 Santhosh Edukulla : > Actually, there is also a module by name "Array" > > import array > t=array.array(I,size) But is this allowed in RPython code? -- Amaury Forgeot d'Arc ___ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/m

Re: [pypy-dev] Arrays in rpython

2011-06-07 Thread Santhosh Edukulla
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 wrote: > On Mon, Jun 6, 2011 at 8:54 PM, Timothy Baldridge > wrote: >>> In cas

Re: [pypy-dev] Arrays in rpython

2011-06-06 Thread Maciej Fijalkowski
On Mon, Jun 6, 2011 at 8:54 PM, Timothy Baldridge 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 li

Re: [pypy-dev] Arrays in rpython

2011-06-06 Thread Timothy Baldridge
> 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. >

Re: [pypy-dev] Arrays in rpython

2011-06-06 Thread Amaury Forgeot d'Arc
Hi, 2011/6/6 Timothy Baldridge : > Is there a way in rpython to specify that a given list should be > implemented as an array? I want to create a list of objects exactly 32 > entries long. I could use [] but it seems like that would be slower > than using an array. In CPython I can create an array

[pypy-dev] Arrays in rpython

2011-06-06 Thread Timothy Baldridge
Is there a way in rpython to specify that a given list should be implemented as an array? I want to create a list of objects exactly 32 entries long. I could use [] but it seems like that would be slower than using an array. In CPython I can create an array of primitive types, but I'm looking to cr