summaryrefslogtreecommitdiff
path: root/numpy/core/_internal.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-01-06 10:14:10 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-01-06 10:14:10 +0000
commit6315c4c27eaeca7f2080ea585b1901e2b683b3ff (patch)
tree2777bf768a4fb125ad3ceb1940f46f70ad4e2d51 /numpy/core/_internal.py
parent5f5c4b92573a060d20cf9bbf70db00d45cda7268 (diff)
downloadnumpy-6315c4c27eaeca7f2080ea585b1901e2b683b3ff.tar.gz
Added new feature to .view method so that if the argument is a sub-type of the ndarray, an object is returned with all the information of the array.
Diffstat (limited to 'numpy/core/_internal.py')
-rw-r--r--numpy/core/_internal.py16
1 files changed, 1 insertions, 15 deletions
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py
index 260381e85..749e63432 100644
--- a/numpy/core/_internal.py
+++ b/numpy/core/_internal.py
@@ -230,21 +230,7 @@ def _array_descr(descriptor):
if fields is None:
return descriptor.dtypestr
- #get ordered list of fields with names
- ordered_fields = fields.items()
- # remove duplicates
- new = {}
- for item in ordered_fields:
- # We don't want to include redundant or non-string
- # entries
- if not isinstance(item[0],str) or (len(item[1]) > 2 \
- and item[0] == item[1][2]):
- continue
- new[item[1]] = item[0]
- ordered_fields = [x[0] + (x[1],) for x in new.items()]
- #sort the list on the offset
- ordered_fields.sort(lambda x,y : cmp(x[1],y[1]))
-
+ ordered_fields = [fields[x] + (x,) for x in fields[-1]]
result = []
offset = 0
for field in ordered_fields: