FW: [Numpy-discussion] typecodes in numarray

Todd Miller jmiller at stsci.edu
Mon Jan 27 11:39:01 CST 2003


Paul F Dubois wrote:

>IMHO you can assume any Python you want. Look to the long term here, not the
>short.
>
You lost me.  numarray-0.4 needs at least Python-2.2 or baseclasses 
don't exist.  I had a slow Python equivalent for the baseclass as I 
refactored prior to numarray-0.4,  but it's gone now.

>
>I'm a bit uncertain on MA as to whether my old design is right. Maybe I
>should be inheriting from NDarray? So that MA is more of a sibling of
>numarray rather than a wrapper of it?
>  
>
I asked Perry about this one.  His points (salted a little by me) were:

1. If you inherit from NumArray,  you also inherit from NDArray.  If you 
only inherit from NDArray,  all you get are the structural operations.

2. If you inherit from NumArray,  you can use Liskov substitution to 
pass MA's directly into extensions expecting NumArrays.  This 
substitution may or may not be good.  Also,  isinstance(anMA, numarray) 
will return True.  

3. If you inherit from NumArray,  you get numerical method definitions 
which may or may not be applicable to MA.  With a little thrashing,  we 
might also get MAs to work for ufuncs.   In fact, ufuncs are the key to 
whether or not the NumArray numerical methods add any value.

Todd

>  
>






More information about the Numpy-discussion mailing list