diff options
author | Jarrod Millman <millman@berkeley.edu> | 2007-11-28 05:12:37 +0000 |
---|---|---|
committer | Jarrod Millman <millman@berkeley.edu> | 2007-11-28 05:12:37 +0000 |
commit | 6c00b1141fdfa7d168a9b82e6ab493c77f7c1621 (patch) | |
tree | 0e9b0714a7d0a5e83ca3d321b4d9aca588347f4a /numpy/numarray | |
parent | 3fe715c0d0deb78ace46c3dbaf3165e8c4283e3c (diff) | |
download | numpy-6c00b1141fdfa7d168a9b82e6ab493c77f7c1621.tar.gz |
use 'in' keyword to test dictionary membership
Diffstat (limited to 'numpy/numarray')
-rw-r--r-- | numpy/numarray/numerictypes.py | 6 | ||||
-rw-r--r-- | numpy/numarray/session.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/numpy/numarray/numerictypes.py b/numpy/numarray/numerictypes.py index 612ba0261..99473097d 100644 --- a/numpy/numarray/numerictypes.py +++ b/numpy/numarray/numerictypes.py @@ -80,13 +80,13 @@ _tObject = 14 def IsType(rep): """Determines whether the given object or string, 'rep', represents a numarray type.""" - return isinstance(rep, NumericType) or typeDict.has_key(rep) + return isinstance(rep, NumericType) or rep in typeDict def _register(name, type, force=0): """Register the type object. Raise an exception if it is already registered unless force is true. """ - if typeDict.has_key(name) and not force: + if name in typeDict and not force: raise ValueError("Type %s has already been registered" % name) typeDict[name] = type return type @@ -104,7 +104,7 @@ class NumericType(object): particular type parameterization, i.e. the second time you try to create "Int32", you get the original Int32, not a new one. """ - if typeDict.has_key(name): + if name in typeDict: self = typeDict[name] if self.bytes != bytes or self.default != default or \ self.typeno != typeno: diff --git a/numpy/numarray/session.py b/numpy/numarray/session.py index ee155f9dc..e1b079103 100644 --- a/numpy/numarray/session.py +++ b/numpy/numarray/session.py @@ -165,7 +165,7 @@ class _ModuleProxy(object): return False def _loadmodule(module): - if not sys.modules.has_key(module): + if module not in sys.modules: modules = module.split(".") s = "" for i in range(len(modules)): |