[Numpy-discussion] Latest Array-Interface PEP

Torgil Svensson torgil.svensson at gmail.com
Wed Jan 10 23:28:52 EST 2007


On 1/4/07, Travis Oliphant <oliphant at ee.byu.edu> wrote:
>
> still be used to describe a complicated block of memory to another user.

Thinking of the scope "seamless data exchange between modules" my
concern with this PEP is that is might be too much focused on "block
of memory" rather than "access to data". Data that can be interpreted
as an n-dimensional array doesn't necessarily has to be represented
directly as a block of memory.

Example1: We have a very large amount of data with a compressed
internal representation

Example2: We might want to generate data "on the fly" as it's needed

Example3: If module creators to deal with different byte alignments,
contiguousness etc it'll lead to lots of code duplication and
unnecessarily much work

Is it possible to add a data access API to this PEP? Direct memory
access could be available through this API with a function that return
the memory address (or NULL if not available). We could have a default
implementation for basic types with the option for module creators to
override this.

The problem with this, if we stick to the buffer protocol, is that it
breaks the concept "buffer is memory" if that ever was a valid. This
is of minor concern for me though.



More information about the NumPy-Discussion mailing list