You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>>fromnumpyimportarray, dtype# The repr of a dtype object distinguishes non-native byteorder.>>>dtype('<u2')
dtype('uint16')
>>>dtype('>u2')
dtype('>u2')
# But arrays always use the repr of the native endianness>>>array([0], dtype='<u2')
array([0], dtype=uint16)
>>>array([0], dtype='>u2')
array([0], dtype=uint16) # <-- this is confusing
This isn't strictly speaking a bug, but using the byteorder-sensitive repr of the dtype instead would make it easier to tell when you have an endianness issue in e.g. this StackOverflow question.
The text was updated successfully, but these errors were encountered:
@mattip - any tips on where I should be looking to fix this?
Twenty minutes with grep and examining various __repr__-related code snippets didn't get me anywhere, though I can see from https://github.com/numpy/numpy/blob/main/numpy/core/_dtype.py that it might be tricky if I can't simply have the array repr defer to the dtype repr...
This isn't strictly speaking a bug, but using the byteorder-sensitive repr of the dtype instead would make it easier to tell when you have an endianness issue in e.g. this StackOverflow question.
The text was updated successfully, but these errors were encountered: