aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-04 17:44:47 +0000
committerGuido van Rossum <guido@python.org>2007-05-04 17:44:47 +0000
commitc2b87a6dff1edade6542a484cb9b9419b254c1ed (patch)
tree7fdb6de335827150b6ac35e2af08c801cd902d3a /Lib/optparse.py
parentAdd 8-bit chr() back as chr8(). (diff)
downloadcpython-c2b87a6dff1edade6542a484cb9b9419b254c1ed.tar.gz
cpython-c2b87a6dff1edade6542a484cb9b9419b254c1ed.tar.bz2
cpython-c2b87a6dff1edade6542a484cb9b9419b254c1ed.zip
Don't use StringType -- always test for basestring.
Diffstat (limited to 'Lib/optparse.py')
-rw-r--r--Lib/optparse.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/optparse.py b/Lib/optparse.py
index 8e1ef52b94c..ae48c7ccdaf 100644
--- a/Lib/optparse.py
+++ b/Lib/optparse.py
@@ -823,7 +823,7 @@ except NameError:
(True, False) = (1, 0)
def isbasestring(x):
- return isinstance(x, types.StringType) or isinstance(x, types.UnicodeType)
+ return isinstance(x, basestring)
class Values:
@@ -1001,7 +1001,7 @@ class OptionContainer:
"""add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
"""
- if type(args[0]) is types.StringType:
+ if isbasestring(args[0]):
option = self.option_class(*args, **kwargs)
elif len(args) == 1 and not kwargs:
option = args[0]
@@ -1312,7 +1312,7 @@ class OptionParser (OptionContainer):
def add_option_group(self, *args, **kwargs):
# XXX lots of overlap with OptionContainer.add_option()
- if type(args[0]) is types.StringType:
+ if isbasestring(args[0]):
group = OptionGroup(self, *args, **kwargs)
elif len(args) == 1 and not kwargs:
group = args[0]