mirror of
https://github.com/python/cpython.git
synced 2025-07-31 07:04:42 +00:00
Change isbasestring function as discussed on the cvs list a while ago
This commit is contained in:
parent
ed444e52da
commit
5b25bc0598
1 changed files with 7 additions and 5 deletions
|
@ -823,12 +823,14 @@ try:
|
||||||
except NameError:
|
except NameError:
|
||||||
(True, False) = (1, 0)
|
(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)
|
return isinstance(x, basestring)
|
||||||
except:
|
|
||||||
return isinstance(x, types.StringType) or isinstance(x, types.UnicodeType)
|
|
||||||
|
|
||||||
|
|
||||||
class Values:
|
class Values:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue