[Todd Miller, wants to use rank-0 arrays as regular old indices] Here's a sick idea: given Python 2.2, you *could* make the type of a rank-0 array a subclass of Python's int type, making sure (if needed) to copy the value into "the int part" at the start of the struct. Then a rank-0 array would act like an integer in almost all contexts requiring a Python int, including use as a sequence index. The relevant code in the core is if (PyInt_Check(key)) return PySequence_GetItem(o, PyInt_AsLong(key)); in PyObject_GetItem(). PyInt_Check() says "yup!" for an instance of any subclass of int, and PyInt_AsLong() extracts "the int part" out of any instance of any subclass of int. In return, it shifts the burden onto convincing the rest of numarray that the thing is still an array too <0.4 wink>.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4