[Numpy-discussion] add .H attribute?

Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Tue Jul 23 17:08:11 EDT 2013

On 07/23/2013 07:53 PM, Alan G Isaac wrote:
> I'm trying to understand the state of this discussion.
> I believe that propoents of adding a .H attribute have
> primarily emphasized
> - readability (and general ease of use)
> - consistency with matrix and masked array
> - forward looking (to a future when .H can be a view)

I disagree with this being forward looking, as it explicitly creates a 
situation where code will break if .H becomes a view, e.g.:

xh = x.H
x *= 2
assert np.all(2 * xh == x.H)

> The opponents have primarily emphasized
> - inconsistency with convention that for arrays
>     instance attributes should return views

I'd formulate this as simply "inconsistency with .T"; they are both 
motivated primarily as notational shorthands.

Dag Sverre

More information about the NumPy-Discussion mailing list