[Numpy-discussion] Will transpose ever need to copy data?

Nathaniel Smith njs@pobox....
Wed Jun 12 08:48:25 CDT 2013


On Tue, Jun 11, 2013 at 5:24 PM, Jaime Fernández del Río
<jaime.frio@gmail.com> wrote:
> I noticed today that the documentation for np.transpose states, for the
> return value, that "A view is returned whenever possible."
>
> Is there really any situation where swapping axes around could trigger the
> need to copy data, or will a view always be returned no matter what?

Sounds like a doc bug. (Probably someone being over-careful -- the
default for many operations in numpy is that it's undefined whether
they return a view or not, so if it makes a difference to you you need
to take an explicit copy or similar.) Want to submit a PR to fix the
doc?

-n


More information about the NumPy-Discussion mailing list