A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-July/121077.html below:

[Python-Dev] 2to3 porting HOWTO: setup.py question

[Python-Dev] 2to3 porting HOWTO: setup.py question [Python-Dev] 2to3 porting HOWTO: setup.py questionR. David Murray rdmurray at bitdance.com
Sun Jul 22 15:08:48 CEST 2012
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.build_py import build_py_2to3 as build_py
> except ImportError:  # Python 2
>   from distutils.command.build_py import build_py
> 
> instead of explicit check like:
> import sys
> if sys.version_info[0] >= 3:
>     from distutils.command.build_py import build_py_2to3 as build_py

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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4