<p><br>
On Jul 24, 2012 10:32 AM, "Terry Reedy" <<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>> wrote:<br>
><br>
> On 7/24/2012 12:44 AM, anatoly techtonik wrote:<br>
><br>
>> Python 3 check explicitly tells the reader that 2to3 should only be<br>
>> used in Python 3. Otherwise everybody need to guess when this *_2to3<br>
>> tools are triggered. As for me, I see no technical limitations why<br>
>> *_2to3 can not be run by Python 2 (PyPy, RPython or whatever). Maybe I<br>
>> don't have Python3, but want to build my package for Python 3. In<br>
>> ideal world it is possible.<br>
><br>
><br>
> This is not an ideal world and 2to3 is not good enough to convert files without further intervention and testing.</p>
<p>Which is exactly why it's use should be explicit. To go back to the original question is it not better to be explicit about the version check? The try/importerror snippet in setup.py is often accompanied by a comment that explains the fact that it is implicitly performing a version check whereas I find the explicit version check self documenting.</p>
<p>I know python users often frown upon explicitly checking with if/else, preferring the flexibility afforded by duck typing and the possibility of monkey patching but I don't see any advantage in this case. As said above, "it's called checking the thing that matters" which is definitely the python version.<br>
<br>
Oscar</p>
<p>><br>
> -- <br>
> Terry Jan Reedy<br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Python-Dev mailing list<br>
> <a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/python-dev">http://mail.python.org/mailman/listinfo/python-dev</a><br>
> Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/oscar.j.benjamin%40gmail.com">http://mail.python.org/mailman/options/python-dev/oscar.j.benjamin%40gmail.com</a><br>
</p>