summaryrefslogtreecommitdiffstats
path: root/Lib/optparse.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-18 22:13:04 (GMT)
committerGuido van Rossum <guido@python.org>2006-08-18 22:13:04 (GMT)
commite2b70bcf7401477936fba99a8bf4a1f759ecc8a3 (patch)
tree4c9b65b7fd8c26a3d2f1b64ecd6b4c72a756b4b2 /Lib/optparse.py
parentd2dbecb4ae9177e2e87adcb047147c6bcbf28cc1 (diff)
downloadcpython-e2b70bcf7401477936fba99a8bf4a1f759ecc8a3.zip
cpython-e2b70bcf7401477936fba99a8bf4a1f759ecc8a3.tar.gz
cpython-e2b70bcf7401477936fba99a8bf4a1f759ecc8a3.tar.bz2
Get rid of dict.has_key(). Boy this has a lot of repercussions!
Not all code has been fixed yet; this is just a checkpoint... The C API still has PyDict_HasKey() and _HasKeyString(); not sure if I want to change those just yet.
Diffstat (limited to 'Lib/optparse.py')
-rw-r--r--Lib/optparse.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/optparse.py b/Lib/optparse.py
index 62d2f7e..a02f79a 100644
--- a/Lib/optparse.py
+++ b/Lib/optparse.py
@@ -602,7 +602,7 @@ class Option:
def _set_attrs(self, attrs):
for attr in self.ATTRS:
- if attrs.has_key(attr):
+ if attr in attrs:
setattr(self, attr, attrs[attr])
del attrs[attr]
else:
@@ -854,7 +854,7 @@ class Values:
are silently ignored.
"""
for attr in dir(self):
- if dict.has_key(attr):
+ if attr in dict:
dval = dict[attr]
if dval is not None:
setattr(self, attr, dval)
@@ -974,10 +974,10 @@ class OptionContainer:
def _check_conflict(self, option):
conflict_opts = []
for opt in option._short_opts:
- if self._short_opt.has_key(opt):
+ if opt in self._short_opt:
conflict_opts.append((opt, self._short_opt[opt]))
for opt in option._long_opts:
- if self._long_opt.has_key(opt):
+ if opt in self._long_opt:
conflict_opts.append((opt, self._long_opt[opt]))
if conflict_opts:
@@ -1023,7 +1023,7 @@ class OptionContainer:
if option.dest is not None: # option has a dest, we need a default
if option.default is not NO_DEFAULT:
self.defaults[option.dest] = option.default
- elif not self.defaults.has_key(option.dest):
+ elif option.dest not in self.defaults:
self.defaults[option.dest] = None
return option
@@ -1039,8 +1039,8 @@ class OptionContainer:
self._long_opt.get(opt_str))
def has_option(self, opt_str):
- return (self._short_opt.has_key(opt_str) or
- self._long_opt.has_key(opt_str))
+ return (opt_str in self._short_opt or
+ opt_str) in self._long_opt
def remove_option(self, opt_str):
option = self._short_opt.get(opt_str)
@@ -1658,7 +1658,7 @@ def _match_abbrev(s, wordmap):
'words', raise BadOptionError.
"""
# Is there an exact match?
- if wordmap.has_key(s):
+ if s in wordmap:
return s
else:
# Isolate all words with s as a prefix.