Skip to content

Commit

Permalink
MAINT: Cleaned up mintypecode for Py3
Browse files Browse the repository at this point in the history
Using generators instead of full-blown lists
Using set for search instead of list
Using min to get single element insteaf of sorting full list
  • Loading branch information
madphysicist committed Dec 3, 2019
1 parent 3a9a63f commit f0c6e41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion numpy/lib/type_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def mintypecode(typechars, typeset='GDFgdf', default='d'):
return default
if 'F' in intersection and 'd' in intersection:
return 'D'
return min((_typecodes_by_elsize.index(t), t) for t in intersection)[1]
return min(intersection, key=_typecodes_by_elsize.index)


def _asfarray_dispatcher(a, dtype=None):
Expand Down

0 comments on commit f0c6e41

Please sign in to comment.