diff options
| author | Christian Heimes <christian@cheimes.de> | 2008-01-27 19:01:45 +0000 |
|---|---|---|
| committer | Christian Heimes <christian@cheimes.de> | 2008-01-27 19:01:45 +0000 |
| commit | 5b25bc05983c43d1663136bc4ca0e3e472a05c56 (patch) | |
| tree | eca3369ae630afb2203fc5cab3e990c5cd21403f | |
| parent | ed444e52da16d947212afbbc200647a8c8f5b53f (diff) | |
| download | cpython-git-5b25bc05983c43d1663136bc4ca0e3e472a05c56.tar.gz | |
Change isbasestring function as discussed on the cvs list a while ago
| -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 4fbe0947e3..b4a1708021 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: |
