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

Robert Kern robert.kern@gmail....
Wed Jun 12 07:31:19 CDT 2013


On Wed, Jun 12, 2013 at 1:24 PM, Sebastian Berg
<sebastian@sipsolutions.net> wrote:
> On Tue, 2013-06-11 at 09:24 -0700, Jaime Fernández del Río wrote:
>> I noticed today that the documentation for np.transpose states, for
>> the return value, that "A view is returned whenever possible."
>>
> I guess a subclass could cause a copy (the code looks like subclassing
> doing something fancy is not be anticipated, there may be a bug here),
> other then that, I don't see a reason for this comment. Transposing is
> always possible for strided memory patterns and a copy will never occur.

Indeed, there is no codepath in PyArray_Transpose() that even
contemplates a memory copy.

--
Robert Kern


More information about the NumPy-Discussion mailing list