1 Mar 2005 20:08
Some comments on the Numeric3 Draft of 1-Mar-05
Colin J. Williams <cjw <at> sympatico.ca>
2005-03-01 19:08:34 GMT
2005-03-01 19:08:34 GMT
Abstract
The two stage approach, Array and ufuncs PEP's, seems a reasonable way to proceed.Name
Array would be a good choice for the new Type/Class. Python has an array module with an array constructor and an obsolete ArrayType synonym for array. Recognizing the case difference, Array would be a suitable choice. The module might be multiArray.Basic Types
These are, presumably, intended as the types of the data elements contained in an Array instance. I would see then as sub-types of Array. Hopefully some term, more descriptive than void can be used to name bit sequences.It might be useful to have a Table type where there is a header of some sort to keep track, for each column of the column name name and the datatype in that column, so that the user could, optionally specify validity checks.
I wonder why there is a need for 30 new types. Python itself has about 30 distinct types. Wouldn't it be more saleable to think in terms of an Array type/class with three built-in sub-classes (Boolean, Numeric and Object) and 25 or so dataElement types? With this sort of structure, a Matrix class could be implemented as a sub-class of the Numeric sub-class.
Regarding the naming of the Numeric dataElementType, there is benefit to the numarray.numerictypes approach.
Suppose one has:
import numarray.numerictypes as _nt
Then, the editor (PythonWin for example) responds to the entry of "_nt." with a drop down menu offering the available types from which the user can select one.
I suggest that Numeric3 offers the opportunity to drop the word rank from its lexicon. "rank" has an established usage long before digital computers. See: http://mathworld.wolfram.com/Rank.html
Perhaps some abbreviation for "Dimensions" would be acceptable.
len() seems to be treated as a synonym for the number of dimensions. Currently, in numarray, it follows the usual sequence of sequences approach of Python and returns the number of rows in a two dimensional array.
Rank-0 arrays and Python Scalars
Regarding Rank-0 Question 2. I've already, in effect, answered "yes". I'm sure that a more compelling "Pro" could be written
The "Con" case is valid but, I suggest, of no great consequence. In my view, the important considerations are (a) the complexity of training the newcomer and (b) whether the added work should be imposed on the generic code writer or the end user. I suggest that the aim should be to make things as easy as possible for the end user.
The Proposed Solution appear to create complexity for little benefit. It would probably add to the difficulty of persuading the Python folk to accept the proposal.
The Python LongType continues to remain outside the pale. I don't see this as a big problem.
Buffer Behaviour
I gather that a buffer cannot have a hole in it. I believe MatLab provides for the deletion of rows or columns. I don't see this as being an important capability.Mapping Iterator
An example could help here. I am puzzled by "slicing syntax does not work in constructors.".Attributes
Why not make flags of the record class? Then arr.flags.NOTSWAPPED could return a Boolean value.Presumably there will also be Fortran flag. If so, I wonder why the config function needs a fortran parameter.
Methods
numarray also has a useful info() method.dumps()?
Matrix Class
" A default Matrix class will either inherit from or contain the Python class". Surely, almost all of the objects above are to be rooted in "new" style classes. See PEP's 252 and 253 or http://www.python.org/2.2.2/descrintro.htmlColin W.
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
=======================================================
This message is confidential. It may also be privileged or otherwise protected by work product immunity or
other legal rules. If you have received it by mistake please let us know by reply and then delete it from your
system; you should not copy it or disclose its contents to anyone. All messages sent to and from Electrabel
may be monitored to ensure compliance with internal policies and to protect our business. Emails are not
secure and cannot be guaranteed to be error free as they can be intercepted, amended, lost or destroyed, or
contain viruses. Anyone who communicates with us by email is taken to accept these risks.
RSS Feed