six-py3 (YTT202)#
Derived from the flake8-2020 linter.
What it does#
Checks for uses of six.PY3.
Why is this bad?#
six.PY3 will evaluate to False on Python 4 and greater. This is likely
unintended, and may cause code intended to run on Python 2 to run on Python 4
too.
Instead, use not six.PY2 to validate that the current Python major version is
not equal to 2, to future-proof the code.
Example#
Use instead: