[issue38003] Incorrect "fixing" of isinstance tests for basestring

Bob Kline report at bugs.python.org
Fri Sep 6 18:34:51 EDT 2019


Bob Kline <bkline at rksystems.com> added the comment:

> Unless you have a specific proposal, ...

I _do_ have a specific proposal: replace `basestring` with `(str, bytes)`, which preserves the behavior of the original code. So, 

if isinstance(value, basestring)

becomes

if isinstance(value, (str, bytes))

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38003>
_______________________________________


More information about the Python-bugs-list mailing list