[Numpy-discussion] Re: [EXTERNAL] Copy on __setitem__

2024-12-25 Thread Israel, Daniel M via NumPy-Discussion
Sure. I didn’t originally, because I thought it would require an entire custom array container, but the following trivial example actually shows the behavior in question: import numpy class MyThing(object): def __array__(self, dtype=None, copy=None): print(f"MyThing.__array__(dtype

[Numpy-discussion] Copy on __setitem__

2024-12-25 Thread Israel, Daniel M via NumPy-Discussion
I was updating some code that uses a custom array container built with the mixin library. Specifically, I was trying to eliminate some warnings due to the change to the __array__ interface to add a copy argument. In doing so, I discovered that, for two objects u, v in my container class, the c