On 15/2/22 09:53, Stefan van der Walt wrote:
On Mon, Feb 14, 2022, at 12:45, Sebastian Berg wrote:
But this is currently *not* consistently the case.  I wish to make this
consistent.  The confusion is around object arrays, though:

     value = np.array(None, dtype=object)
     arr[0] = value

Stores `value` without unpacking it currently.

     arr.fill(value)

Stores the `None` (unpacking `value`) if and only if `value` is 0-D.
That last behavior doesn't look right to me.  An object array should be thought 
of as a collection of pointers, and if you happen to want to point to a NumPy 
array, so be it.
I think we should strive for consistency and code simplicity. In the non-object case, it is clear that assignment will try to unpack an ndarray. So we should do the same thing with object arrays, and document the change in behaviour. Could we suggest a backward compatible alternative (would using a record dtype fit better with Stefan's mental model)?

Matti


_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to