[Python-ideas] sys.py3k

Georg Brandl g.brandl at gmx.net
Mon Nov 5 07:55:24 CET 2012


Am 04.11.2012 22:49, schrieb anatoly techtonik:
> if sys.py3k:
>   # some py2k specific code
>   pass
> 
> 
> Why?
>  1. readable
>  2. traceable
> 
> Explained:
>  1. self-explanatory
>  2. sys.version_info >= (3, 0) or  sys.version[0] == '3' is harder to
> trace when you need to find all python 3 related hacks

This proposal is roughly 3 minor versions late.  I can offer you
a sys.py3_4 attribute though... ;)

Georg




More information about the Python-ideas mailing list