I'm not sure if I'm using the correct vocabulary here, but I have a use case for creating writable view into a numpy record array. I'm seeing a discrepancy in the way numpy behaves depending on how I do the selection. The following code snippet is a minimal example.
import numpy as np
a = np.asarray([(True, 1), (False, 2), (True, 3), (False, 4)], dtype=np.dtype([('b', 'b1'), ('i', 'i4')]))
mask = a['b']
a[mask]['i'] = 0
print((a[mask]['i'] == 0).all()) # this is false
a['i'][mask] = 0
print((a[mask]['i'] == 0).all()) # this is true
Is this intended behavior or is it a bug? Is there some other way go generate a sub-record array that avoids copying the data?