[Python-Dev] 2to3 porting HOWTO: setup.py question (original) (raw)
R. David Murray rdmurray at bitdance.com
Sun Jul 22 15:08:48 CEST 2012
- Previous message: [Python-Dev] 2to3 porting HOWTO: setup.py question
- Next message: [Python-Dev] Print policy for deprecated modules
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 22 Jul 2012 11:21:38 +0300, anatoly techtonik <techtonik at gmail.com> wrote:
http://docs.python.org/py3k/howto/pyporting.html#during-installation
What's the point in making implicit Python 3 check here: try: # Python 3 from distutils.command.buildpy import buildpy2to3 as buildpy except ImportError: # Python 2 from distutils.command.buildpy import buildpy instead of explicit check like: import sys if sys.versioninfo[0] >= 3: from distutils.command.buildpy import buildpy2to3 as buildpy
It's called testing for the thing that actually matters, rather than testing a constant with a much broader meaning. Yes, in this case the results are the same, but IMO it is better programming practice to test the thing that actually matters when you can.
--David
- Previous message: [Python-Dev] 2to3 porting HOWTO: setup.py question
- Next message: [Python-Dev] Print policy for deprecated modules
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]