diff options
author | Guido van Rossum <guido@python.org> | 2006-08-19 02:45:06 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-08-19 02:45:06 (GMT) |
commit | 1b01e5c706a1fd2bef24ec3e67c41b16423bcd7b (patch) | |
tree | 99388ee6f8a2c56c4ed6808317bfa12829dd3be6 /Lib/xml/sax | |
parent | 5c303dec170a0c4cb278c819869e652b0832725e (diff) | |
download | cpython-1b01e5c706a1fd2bef24ec3e67c41b16423bcd7b.zip cpython-1b01e5c706a1fd2bef24ec3e67c41b16423bcd7b.tar.gz cpython-1b01e5c706a1fd2bef24ec3e67c41b16423bcd7b.tar.bz2 |
Fix some more has_key() uses. This could really use a tool to automate...
Diffstat (limited to 'Lib/xml/sax')
-rw-r--r-- | Lib/xml/sax/__init__.py | 4 | ||||
-rw-r--r-- | Lib/xml/sax/xmlreader.py | 9 |
2 files changed, 5 insertions, 8 deletions
diff --git a/Lib/xml/sax/__init__.py b/Lib/xml/sax/__init__.py index 054064c..d55ffb7 100644 --- a/Lib/xml/sax/__init__.py +++ b/Lib/xml/sax/__init__.py @@ -59,7 +59,7 @@ if _false: import xml.sax.expatreader import os, sys -if os.environ.has_key("PY_SAX_PARSER"): +if "PY_SAX_PARSER" in os.environ: default_parser_list = os.environ["PY_SAX_PARSER"].split(",") del os @@ -81,7 +81,7 @@ def make_parser(parser_list = []): return _create_parser(parser_name) except ImportError,e: import sys - if sys.modules.has_key(parser_name): + if parser_name in sys.modules: # The parser module was found, but importing it # failed unexpectedly, pass this exception through raise diff --git a/Lib/xml/sax/xmlreader.py b/Lib/xml/sax/xmlreader.py index 1cade65..1763ea4 100644 --- a/Lib/xml/sax/xmlreader.py +++ b/Lib/xml/sax/xmlreader.py @@ -294,12 +294,12 @@ class AttributesImpl: return self._attrs[name] def getNameByQName(self, name): - if not self._attrs.has_key(name): + if name not in self._attrs: raise KeyError, name return name def getQNameByName(self, name): - if not self._attrs.has_key(name): + if name not in self._attrs: raise KeyError, name return name @@ -318,11 +318,8 @@ class AttributesImpl: def keys(self): return self._attrs.keys() - def has_key(self, name): - return self._attrs.has_key(name) - def __contains__(self, name): - return self._attrs.has_key(name) + return name in self._attrs def get(self, name, alternative=None): return self._attrs.get(name, alternative) |