[Numpy-discussion] numpy.numarray.transpose()

Bruce Southey bsouthey at gmail.com
Mon Sep 28 10:29:30 EDT 2009


On 09/28/2009 03:15 AM, Pauli Virtanen wrote:
> Mon, 28 Sep 2009 10:07:47 +0200, Michael.Walker wrote:
> [clip]
>    
>> In [7]: f = f.transpose()
>>
>> In [8]: print f
>> [[1 3]
>>   [2 4]]
>>
>> as expected. I mention this because I think that it is worth knowing
>> having lost a LOT  of time to it. Is it worth filing as a bug report?
>>      
> Yes. It indeed seems that in numarray, transpose() transposes the array
> in-place.
>
> This could maybe be fixed by a new numarray-emulating ndarray subclass.
> The tricky problem then is that some functions don't, IIRC, preserve
> subclasses, which may lead to surprises. (Anyway, these should be fixed
> at some point...)
>
> At the least, we should write a well-visible "differences to numarray"
> document that explains all differences and known bugs.
>
>    
This is not a bug! This specific difference between numpy and numarray 
is documented on the 'converting from numarray' page:
http://www.scipy.org/Converting_from_numarray

What actually is incorrect is that the numpy.numarray.transpose has the 
same docstring as numpy.transpose. So it would be very helpful to first 
correct the numpy.array.transpose documentation.

A larger goal would be to correctly document all the numpy.numarray and 
numpy.numeric functions as these should not be linked to the similar 
numpy functions. If these are identical then it should state that, what 
differences exist and then refer to equivalent numpy page for example, 
numpy.numarray.matrixmultiply and numpy.dot. Also, the documentation for 
these numpy.numarray and numpy.numeric functions should state that these 
are mainly included for compatibility reasons and may be removed at a 
future date.


Bruce




More information about the NumPy-Discussion mailing list