diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/_dtype.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/numpy/core/_dtype.py b/numpy/core/_dtype.py index 5047e194a..26c44eaaf 100644 --- a/numpy/core/_dtype.py +++ b/numpy/core/_dtype.py @@ -20,10 +20,10 @@ def __str__(dtype): def __repr__(dtype): - if dtype.fields is not None: - return _struct_repr(dtype) - else: - return "dtype({})".format(_construction_repr(dtype, include_align=True)) + arg_str = _construction_repr(dtype, include_align=False) + if dtype.isalignedstruct: + arg_str = arg_str + ", align=True" + return "dtype({})".format(arg_str) def _unpack_field(dtype, offset, title=None): @@ -292,15 +292,6 @@ def _subarray_str(dtype): ) -def _struct_repr(dtype): - s = "dtype(" - s += _struct_str(dtype, include_align=False) - if dtype.isalignedstruct: - s += ", align=True" - s += ")" - return s - - def _name_get(dtype): # provides dtype.name.__get__ |