[Numpy-discussion] add .H attribute?

Dave Hirschfeld dave.hirschfeld at gmail.com
Tue Jul 23 03:35:41 EDT 2013


Alan G Isaac <alan.isaac <at> gmail.com> writes:

> 
> On 7/22/2013 3:10 PM, Nathaniel Smith wrote:
> > Having .T but not .H is an example of this split.
> 
> Hate to do this but ...
> 
>   Readability counts.

+10!

A.conjugate().transpose() is unspeakably horrible IMHO. Since there's no way 
to avoid a copy you gain nothing by not providing the convenience function. 

It should be fairly obvious that an operation which changes the values of an 
array (and doesn't work in-place) necessarily takes a copy. I think it's more 
than sufficient to simply document the fact that A.H will return a copy.

A user coming from Matlab probably doesn't care that it takes a copy but you'd 
be hard pressed to convince them there's any benefit of writing 
A.conjugate().transpose() over exactly what it looks like in textbooks - A.H

Regards,
Dave




More information about the NumPy-Discussion mailing list