[Numpy-discussion] Array Protocol change for Python 2.6 (original) (raw)
Andrew Straw strawman at astraw.com
Fri Jun 9 16:51:57 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 ]
Travis Oliphant wrote:
Andrew Straw wrote:
On the one hand, I feel we should keep arraystruct 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 arraydescr information has already proven unnecessary. I must say that I, and probably others, thought that arraystruct 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. I don't see how it breaks any code in the wild to add an additional member to the C-struct. We could easily handle it in new code with a flag setting (like Python uses). The only possible problem is looking for it when it is not there.
Ahh, thanks for clarifying. Let me paraphrase to make sure I got it right: given a C-struct "inter" of type PyArrayInterface, if and only if ((inter.flags & HAS_ARRAY_DESCR) == HAS_ARRAY_DESCR) inter could safely be cast as PyArrayInterfaceWithArrayDescr and thus expose a new member. This does seem to avoid all the issues and maintain backwards compatibility. I guess the only potential complaint is that it's a little C trick which might be unpalatable to the core Python devs, but it doesn't seem egregious to me.
If I do understand this issue, I'm +1 for the above scheme provided the core Python devs don't mind.
Cheers! Andrew
- 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 ]