Stop writing Python 4 incompatible code

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Jan 13 16:38:57 EST 2016


Steven D'Aprano wrote:
> Quote:
> 
>         if six.PY2:
>             # Python 2 code
>         elif six.PY3:
>             # Python 3 code
> 
>     In this case, no code will get executed on Python 4 at all!

Which is good, because if no code is executed, it can't exhibit
any bugs.

Everyone should write their code this way, and then Python 4
will make *all* bugs in *all* programs disappear!

-- 
Greg



More information about the Python-list mailing list