No, I don't do it now. But taking like granted the fact that 2.x python will
be dead in 5 years and that /usr/bin/python will point to python3 is, imho,
a little too optimistic. Thus, as time passes, python scripts will have to
guess if they are running through python3 or python2 because the two will be
installed on most systems, with no strict convention on how to run a 2.x
python script or a 3.x python script.

/usr/bin/python is meant to point to python3 one time or another. The time
will never be the same for all distros.

And, yes, people are already testing python version in their
scripts<http://www.google.com/search?q=python+version+test+site%3Astackoverflow.com&ie=utf-8>
.

As a matter of fact, they've already had this kind of discussion for Perl :
they use require <http://perldoc.perl.org/functions/require.html>.


Jérôme.


2011/3/2 Steven D'Aprano <st...@pearwood.info>

> Steven D'Aprano wrote:
>
>> Jérôme Radix wrote:
>>
>>> Hello,
>>>
>>> Defensive programming will force you to do things like :
>>>
>>> import sys
>>> if sys.version[0] == '2':
>>>
>>
>>
>> Really? Do you already do this?
>>
>> if sys.version < '2.2':
>>    result = apply(func, arguments)
>> else:
>>    result = func(*arguments)
>>
>>
>> And if so, have you tested it in Python 1.5 to see what happens?
>>
>
> Sorry, that reads harsher than I intended. Please insert a wink and a
> smiley.
>
>
>
>
> --
> Steven
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/jerome.radix%40gmail.com
>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to