[Numpy-discussion] Contiguity of result of astype changed - intentional?

Matthew Brett matthew.brett at gmail.com
Thu Sep 13 08:59:06 EDT 2012


Hi,

On Wed, Sep 12, 2012 at 10:24 PM, Ondřej Čertík <ondrej.certik at gmail.com> wrote:
> Hi Matt,
>
> On Wed, Sep 12, 2012 at 1:27 PM, Travis Oliphant <travis at continuum.io> wrote:
>>>>>
>>>>> Is this intended?  Is there a performance reason to keep the same
>>>>> strides in 1.7.0?
>>>>
>>>> I believe that this could be because in 1.7.0, NumPy was changed so that copying does not always default to "C-order" but to "Keep-order".    So, in 1.7.0, the strides of b is governed by the strides of a, while in 1.6.1, the strides of b is C-order (because of the copy).
>>>>
>>>
>>> Thanks for the reply.
>>>
>>> So maybe the bottom line is that the user should not assume any
>>> contiguity from ``astype``?   If that's the case I'll submit a
>>> docstring PR to say that.
>>>
>>
>> Yes, that would be a great addition to the docstring.   Mark, can you confirm this is the desired behavior?  Ondrej, this would be something to put in the release notes, if it isn't already.
>
> If you could submit the PR with the docs, that'd be awesome. In the
> meantime, I've created an issue for it:
>
> https://github.com/numpy/numpy/issues/437
>
> and put it into my TODO list:
>
> https://github.com/numpy/numpy/issues/396

Sorry - inadequate research on my part - the current docstring for
``astype`` is clear and comprehensive, and the change was obviously
intentional.

Cheers,

Matthew



More information about the NumPy-Discussion mailing list