summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r--numpy/core/arrayprint.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index a243366b7..dcfb6e6a8 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -1428,6 +1428,10 @@ def dtype_is_implied(dtype):
# not just void types can be structured, and names are not part of the repr
if dtype.names is not None:
return False
+
+ # should care about endianness *unless size is 1* (e.g., int8, bool)
+ if not dtype.isnative:
+ return False
return dtype.type in _typelessdata
@@ -1453,10 +1457,14 @@ def dtype_short_repr(dtype):
return "'%s'" % str(dtype)
typename = dtype.name
+ if not dtype.isnative:
+ # deal with cases like dtype('<u2') that are identical to an
+ # established dtype (in this case uint16)
+ # except that they have a different endianness.
+ return "'%s'" % str(dtype)
# quote typenames which can't be represented as python variable names
if typename and not (typename[0].isalpha() and typename.isalnum()):
typename = repr(typename)
-
return typename