[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] numpy migration (again)



Sorry, I should try to explain it a bit better.

pygame will use the array.array module instead of numeric.

Then there will be python code which will take array.array instances,
and wrap them up with numeric, or numpy instances.  This will all be
done in python.  So you can load numeric, or numpy in python, and do
all the wrapping in python.

The interface to python std arrays ie: array.array instances will be done in C.

eg. This is kind of how this function will be written:
pygame.surfarray.pixels2d(Surface): return array

def pixels2d(s):
   p = pygame.surfarray_array.pixels2d(s)
   # we pass the surface, so we can query the dimensions.
   numeric_array = make_numeric_array_from_array_array(p, s)
   return numeric_array


On 7/21/07, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
René Dudfield wrote:
> Not copying unless asked to.
>
> python arrays are mutable, so you need to copy explicitly.  So the
> pixels calls will still work as they do now.

I still don't understand *how* this will allow Numeric
and/or numpy arrays to be used without pygame having
any dependency on those packages.

Or are you talking about the new array interface
that's coming rather than the existing array module?

--
Greg