running python 2 vs 3

Chris Angelico rosuav at gmail.com
Thu Mar 20 19:04:58 EDT 2014


On Fri, Mar 21, 2014 at 7:08 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Alan Meyer <ameyer2 at yahoo.com>:
>
>> I presume it would still be a good idea to test both python
>> interpreters against any script that you didn't knowingly write with a
>> feature that will only work in one of the two python versions.
>>
>> If it works fine in both - and many will, then use:
>>
>>      #!/usr/bin/env python
>>
>> Only use the "python2" or "python3" versions if you really have a
>> reason to do so.
>>
>> Yes?  No?
>
> No. Even if you managed to do that, it would mean getting the worst of
> both worlds. The language dialects are too far apart. When you start
> your Python project, you decide between Python 2 and Python 3 and go all
> in.

They're not that far apart. It's not difficult to write code that runs
happily on both. However, it does mean you can't take advantage of
Python 3 features, so it's probably better to write for one or the
other, unless you specifically want wide distribution. For your own
projects, just put whichever you need.

ChrisA



More information about the Python-list mailing list