Message 332343 - Python tracker (original) (raw)

The feature would violate fundamental Python invariants. If you modify the example above:

t = (m,) b"\001\002\003" in t True x[0] = 100 b"\001\002\003" in t False

This is simply never supposed to happen in Python. If an immutable object (Bytes) is regarded as being a member of a tuple, it should stay in that tuple.

The issue has to be fixed on the NumPy side: They could implement a scheme that allows hashing of a specific ndarray if a new flag "IMMUTABLE" is set that locks the exporter and all exports.

I don't thing NumPy's current behavior can be regarded as a bug. As I said, "readonly" never meant "immutable", it was always a property of a single view.