[Numpy-discussion] Some comments on the draft PEP (Rev 1.8)
Colin J. Williams
cjw at sympatico.ca
Thu Feb 17 18:51:20 CST 2005
There is no mention of the record. This was one of the useful ideas
from COBOL and carried over by PL/1. See numarray.record.py.
I suggest it is worth continuing.
Sequence and Mapping 2) The advanced indexing seems to offer masked
extraction from an array, some examples would help.
3) I've always wondered about the
rank 0 array. If such values are returned as scalars then the
processing inside the array package is increased slightly. If they are
returned as an array then there is more work to be done in the Python
code outside the the array package. My preference is to return a scalar.
Iterator. A scalar appears to be much better in this case.
Methods. Why not use properties for those methods which don't require
Some of the maybes are number oriented but the basic
Array is intended to have a wider scope than just numbers.
Implementation Plan The usual convention is that class/type names
start with a capital, thus Array, rather than array. This should clash
with a name on the existing array module. It is good to see that the
Array is to be sub-classable. This is one of the weaknesses of
numarray. 'efficiencies' meant that Python's introspection is not fully
available in NumArray.
C Structures Is NOTSWAPPED, based on system order, going to
give trouble if data is exported from one system to another?
Type characters My feeling is that the numarray.numerictypes
descriptors are clearer for the user who has not memorized the
typecodes. It takes a little more space overhead but simplifies the
Array repr. With an editor, such as PythonWin, one can enter
'MN.numerictypes.'. The editor responds with a drop down list of
available types - MN is an abbreviated code for the imported modules
name (I don't use from X import *). The programmer does not have to
remember the non mnemonic letter codes.
One final request. In the instance constructor, please avoid
the use of 'type' as a parameter name if the constructor is implemented
in Python. This hides the builtin type(), which is sometimes useful in
debugging or exploring code.
I hope that this is of some help.
More information about the Numpy-discussion