[Python-Dev] Expose the array interface in Python 2.5?

Nick Coghlan ncoghlan at gmail.com
Sun Mar 19 03:52:22 CET 2006


Greg Ewing wrote:
> Things are getting a bit confusing, because it seems
> that there are two different things being discussed
> here:
> 
> (1) A C-level array interface that's a generalisation
>     of the buffer interface.
> 
> (2) A new multi-dimensional array object type which
>     happens to implement (1).
> 
> As I understand the proposals, the important thing for
> interoperability between different types is to have
> (1). Whereas (2) would be useful to have, it's not
> a prerequisite for (1).
> 
> Do I understand correctly?

That sounds right to me. Although option 2 is more a matter of "have an 
exemplar of the interface in the standard library that can be used by 
inheritance or containment".

The interface is actually already defined by numpy - Option 1 would involve 
transferring that info to a PEP on python.org without necessarily providing 
any examples of the interface in the standard library. This pushes more work 
onto those wishing to support the interface (since they will need to either 
implement the interface independently or become dependent on another library 
such as numpy).

Option 2 would involve either modifying array.array to expose the interface, 
or adding a new type, array.dimarray, that allowed such structures to be 
accessed, but not necessarily easily manipulated.

Regards,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list