aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-16 18:12:55 +0000
committerGuido van Rossum <guido@python.org>2007-10-16 18:12:55 +0000
commit3172c5d263eeffff1e89d03d79be3ccc1d60fbde (patch)
treea35e103b36b684c4682ded57236199d6a0ecee4b /Lib/optparse.py
parentFor PEP3137: Adds missing methods to the mutable PyBytes object (soon (diff)
downloadcpython-3172c5d263eeffff1e89d03d79be3ccc1d60fbde.tar.gz
cpython-3172c5d263eeffff1e89d03d79be3ccc1d60fbde.tar.bz2
cpython-3172c5d263eeffff1e89d03d79be3ccc1d60fbde.zip
Patch# 1258 by Christian Heimes: kill basestring.
I like this because it makes the code shorter! :-)
Diffstat (limited to 'Lib/optparse.py')
-rw-r--r--Lib/optparse.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/optparse.py b/Lib/optparse.py
index b3de41157bf..f702e1a845f 100644
--- a/Lib/optparse.py
+++ b/Lib/optparse.py
@@ -815,9 +815,6 @@ class Option:
SUPPRESS_HELP = "SUPPRESS"+"HELP"
SUPPRESS_USAGE = "SUPPRESS"+"USAGE"
-def isbasestring(x):
- return isinstance(x, basestring)
-
class Values:
def __init__(self, defaults=None):
@@ -994,7 +991,7 @@ class OptionContainer:
"""add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
"""
- if isbasestring(args[0]):
+ if isinstance(args[0], str):
option = self.option_class(*args, **kwargs)
elif len(args) == 1 and not kwargs:
option = args[0]
@@ -1294,7 +1291,7 @@ class OptionParser (OptionContainer):
defaults = self.defaults.copy()
for option in self._get_all_options():
default = defaults.get(option.dest)
- if isbasestring(default):
+ if isinstance(default, str):
opt_str = option.get_opt_string()
defaults[option.dest] = option.check_value(opt_str, default)
@@ -1305,7 +1302,7 @@ class OptionParser (OptionContainer):
def add_option_group(self, *args, **kwargs):
# XXX lots of overlap with OptionContainer.add_option()
- if isbasestring(args[0]):
+ if isinstance(args[0], str):
group = OptionGroup(self, *args, **kwargs)
elif len(args) == 1 and not kwargs:
group = args[0]