diff options
author | Guido van Rossum <guido@python.org> | 2007-05-04 17:44:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-04 17:44:47 (GMT) |
commit | c2b87a6dff1edade6542a484cb9b9419b254c1ed (patch) | |
tree | 7fdb6de335827150b6ac35e2af08c801cd902d3a /Lib/optparse.py | |
parent | 7fcf224ec804d3dc4791ae25cfee23feb239eabd (diff) | |
download | cpython-c2b87a6dff1edade6542a484cb9b9419b254c1ed.zip cpython-c2b87a6dff1edade6542a484cb9b9419b254c1ed.tar.gz cpython-c2b87a6dff1edade6542a484cb9b9419b254c1ed.tar.bz2 |
Don't use StringType -- always test for basestring.
Diffstat (limited to 'Lib/optparse.py')
-rw-r--r-- | Lib/optparse.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/optparse.py b/Lib/optparse.py index 8e1ef52..ae48c7c 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] |