Is it right to use
if str is bytes: ...
instead
if sys.version_info < (3,): ...
to distinguish python2 from python3? Especially when version-specific code is required precisely because of the possibility that str is not unicode, it sometimes seems to me that it seems clearer (and avoids often free sys imports), but I have never seen python code that uses this test. Is "str is bytes" true only as a fad of CPython version 2 or is it guaranteed in all python2s?
source
share