[Python-Dev] Expose the array interface in Python 2.5? (original) (raw)
Sasha ndarray at mac.com
Sat Mar 18 03:19:11 CET 2006
- Previous message: [Python-Dev] Expose the array interface in Python 2.5?
- Next message: [Python-Dev] Py3K thought: use external library for client-side HTTP
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Travis E. Oliphant" <oliphant.travis ieee.org> wrote:
It is very important for many people to get access to memory with some description of how that memory should be interpreted as an array. Several Python packages could benefit if Python had some notion of an array interface that was at least supported in a duck-typing fashion.
I have just submited a patch to SF that implements array_shape and array_typestr attributes for the array.array class.
These are the only two attributes that are marked "required" in the "N-D array interface" document.
I think it makes sense to discuss these two first. Note that these methods do not add any new functionality. Shape is just (len(a),) and typestr just packs endiness information together with a.typecode and a.itemsize.
The only benefit of adding these two methods is to create "one true way" to access this information.
I am fairly happy with array_shape, but array_typestr feels somewhat archaic. I would rather see ctypes style data description instead of this struct style.
I believe unifying the way different python modules describe binary data is a worthwhile first step in bringing array interface to the core.
- Previous message: [Python-Dev] Expose the array interface in Python 2.5?
- Next message: [Python-Dev] Py3K thought: use external library for client-side HTTP
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]