[Numpy-discussion] Array Protocol change for Python 2.6 (original) (raw)
Andrew Straw strawman at astraw.com
Fri Jun 9 15:26:33 EDT 2006
- Previous message (by thread): [Numpy-discussion] Array Protocol change for Python 2.6
- Next message (by thread): [Numpy-discussion] Array Protocol change for Python 2.6
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On the one hand, I feel we should keep array_struct behaving exactly as it is now. There's already lots of code that uses it, and it's tremendously useful despite (because of?) it's simplicity. For these of use cases, the array_descr information has already proven unnecessary. I must say that I, and probably others, thought that array_struct would be future-proof. Although the magnitude of the proposed change to add this information to the C-struct PyArrayInterface is minor, it still breaks code in the wild.
On the other hand, I'm only beginning to grasp the power of the array_descr information. So perhaps bumping the PyArrayInterface.version to 3 (2 is the current, and as far as I can tell, original version) and going forward would be justified. Perhaps there's a way towards backwards-compatibility -- the various array consumers could presumably support reading both v2 and version 3 nearly forever, but could spit out warnings when reading v2. It seems v3 would be a simple superset of v2, so implementation of this wouldn't be hard. The challenge will be when a implementor returns a v3 array_struct to something that reads only v2. For this reason, maybe it's better to break backwards compatibility now before even more code is written to read v2.
Is it clear what would need to be done to provide a C-struct giving the array_descr information?
What's the problem with keeping array_descr access available only at the Python level? Your original email suggested limiting the number of attributes, which I agree with, but I don't think we need to go to the logical extreme. Does simply keeping array_descr as part of the Python array interface avoid these issues? At what cost?
Cheers! Andrew
Travis Oliphant wrote:
Keep in mind there are two different (but related) issues at play here.
1) What goes in to NumPy 1.0 2) What we propose should go into Python 2.6
I think for #1 we should compress the Python-side array protocol into a single arrayinterface attribute that returns a dictionary. We should also expand the C-struct to contain what arraydescr currently provides. -Travis
Numpy-discussion mailing list Numpy-discussion at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
- Previous message (by thread): [Numpy-discussion] Array Protocol change for Python 2.6
- Next message (by thread): [Numpy-discussion] Array Protocol change for Python 2.6
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]