diff options
author | seberg <sebastian@sipsolutions.net> | 2017-08-06 13:00:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-06 13:00:00 +0200 |
commit | dfba08642ec76cee99e7d78e20865e2e63f89609 (patch) | |
tree | a17f5e8cd12db777b245d1706b3a35a5ff9937b3 | |
parent | 74e603fe5de2c491d0314063e8c0deb29316c4d2 (diff) | |
parent | 9635cf8c606c956fe9c2e22076275d9dbe57763d (diff) | |
download | numpy-dfba08642ec76cee99e7d78e20865e2e63f89609.tar.gz |
Merge pull request #9520 from eric-wieser/remove-TypeType
MAINT: types.TypeType does not ever need to be used
-rw-r--r-- | numpy/core/numerictypes.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index 136081412..275bb3fea 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -543,18 +543,12 @@ _python_types = {int: 'int_', buffer_type: 'void', } -if sys.version_info[0] >= 3: - def _python_type(t): - """returns the type corresponding to a certain Python type""" - if not isinstance(t, type): - t = type(t) - return allTypes[_python_types.get(t, 'object_')] -else: - def _python_type(t): - """returns the type corresponding to a certain Python type""" - if not isinstance(t, _types.TypeType): - t = type(t) - return allTypes[_python_types.get(t, 'object_')] +def _python_type(t): + """ Get a numpy scalar type corresponding to a Python type or value """ + if not isinstance(t, type): + t = type(t) + return allTypes[_python_types.get(t, 'object_')] + def issctype(rep): """ |