diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-27 19:01:59 +0000 |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-27 19:01:59 +0000 |
commit | 0b11c5fdf60b22eeed3d77dd31cbd63c6e2e2f12 (patch) | |
tree | e80b11389375085a6e4619f7ecbbcd1dc2607a89 /Lib/optparse.py | |
parent | 61792348039db8f6d5700b3a92a5150e84a61a85 (diff) | |
download | cpython-git-0b11c5fdf60b22eeed3d77dd31cbd63c6e2e2f12.tar.gz |
Change isbasestring function as discussed on the cvs list a while ago
Diffstat (limited to 'Lib/optparse.py')
-rw-r--r-- | Lib/optparse.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/optparse.py b/Lib/optparse.py index 4fbe0947e3..5aa3b967b0 100644 --- a/Lib/optparse.py +++ b/Lib/optparse.py @@ -823,11 +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: |