diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-27 19:01:45 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-27 19:01:45 (GMT) |
commit | 5b25bc05983c43d1663136bc4ca0e3e472a05c56 (patch) | |
tree | eca3369ae630afb2203fc5cab3e990c5cd21403f /Lib | |
parent | ed444e52da16d947212afbbc200647a8c8f5b53f (diff) | |
download | cpython-5b25bc05983c43d1663136bc4ca0e3e472a05c56.zip cpython-5b25bc05983c43d1663136bc4ca0e3e472a05c56.tar.gz cpython-5b25bc05983c43d1663136bc4ca0e3e472a05c56.tar.bz2 |
Change isbasestring function as discussed on the cvs list a while ago
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/optparse.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/optparse.py b/Lib/optparse.py index 4fbe094..b4a1708 100644 --- a/Lib/optparse.py +++ b/Lib/optparse.py @@ -823,12 +823,14 @@ try: except NameError: (True, False) = (1, 0) -def isbasestring(x): - try: +try: + basestring +except NameError: + def isbasestring(x): + return isinstance(x, (types.StringType, types.UnicodeType)) +else: + def isbasestring(x): return isinstance(x, basestring) - except: - return isinstance(x, types.StringType) or isinstance(x, types.UnicodeType) - class Values: |