[Numpy-discussion] Warn or immidiately change readonly flag on broadcast_arrays return value?

Hameer Abbasi einstein.edison at gmail.com
Tue Dec 25 06:26:29 EST 2018


Hi!

Broadcasting almost always returns a repeated output
(except when all arrays are the same shape), that’s the entire point. I suspect this function is in fairly widespread use and will therefore cause a lot of downstream issues when repeating, so I’m -0.5 on a DeprecationWarning. A FutureWarning might be more appropriate, in which case I’m +0.2.

As for making the output read-only, that might break code, but most likely the code was erroneous anyway. But breaking backward-compatibility without a grace period is unheard of in this community. I’m +0.5 on it anyway. 🤷🏻‍♂️

Overall, a kind of hairy problem with no clear solution.

Best Regards,
Hameer Abbasi

> On Tuesday, Dec 25, 2018 at 12:13 PM, Matti Picus <matti.picus at gmail.com (mailto:matti.picus at gmail.com)> wrote:
> In PR 12609 https://github.com/numpy/numpy/pull/12609 I added code to
> emit a DepricationWarning when broadcast_arrays returns an array where
> the output is repeated. While this is a minimal fix to the problem,
> perhaps we should consider making the output readonly immediately instead?
>
>
> - A deprecation cycle requires two changes to downstream user's code:
> one to filter the deprecation warning, and another when we actually make
> the change
>
> - Writing to the repeated data will cause errors now.
>
>
> What do you think, should we change the behaviour at all, and if so
> should we depricate it over two releases or change it immediately?
>
>
> The original issue is here https://github.com/numpy/numpy/issues/2705
>
>
> Matti
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20181225/0da9936d/attachment.html>


More information about the NumPy-Discussion mailing list