Python version(s) for new project?

Philip Semanchuk philip at semanchuk.com
Thu Mar 26 11:05:53 EDT 2009


On Mar 26, 2009, at 10:34 AM, andrew cooke wrote:

> Philip Semanchuk wrote:
>> Hi all,
>> I'm about to start a new job at which I and others will build a
>> project largely in Python. I'm trying to figure out which Python
>> versions to use and support. I can't use Python 3.x, but I want to
>> prepare for it even if it is a long way off yet.
>>
>> My idea is to use Python 2.6 on my development box and 2.4/2.5 on the
>> test machines. This would allow me to use the -3 switch on my machine
>> so that I keep the code relatively free of features unsupported or
>> deprecated in 3.x. It will also ensure that I write code backwards
>> compatible with older Python versions.
>>
>> Does this sound sane?
>
> i don't know the details of your constraints (what libs require 2.5  
> rather
> than 2.6, for example).

Thanks for your thoughts, Andrew. Should I expect many 2.5-compatible  
libs to have trouble with 2.6?


>  what you say makes sense only if you need to be
> compatible with 2.4/2.5.  if so, you'll find it quite tricky to  
> produce
> code that is compatible across all versions - you will effectively  
> end up
> using the subset of python that is common across 2.4 to 3.

Well, right now I only need to make code that's compatible with 2.x.  
We need to support older versions or Python because I doubt many of  
our prospective users are running 2.6, and few of them will ever  
become users (or code contributors) if we raise the barriers too high.  
I think supporting as far back as 2.4 is a reasonable compromise.

I certainly agree that writing code that's compatible across 2.4 - 3.x  
would be awkward. Fortunately that's not my plan. I just want to  
leverage the -3 switch on Python 2.6 to keep an eye on how many 3.x- 
incompatible features I'm using. Some will be unavoidable -- print  
versus print() comes to mind -- but ideally when the time comes to  
support 3.x, we can just run 2to3 and be done.


> note - my experience is with taking 3.0 code and trying to make it  
> run on
> 2.6 (easy) and 2.5 (hard).  i guess it is possible things are easier  
> if
> you start out with all 3 in mind.

Thanks; it's good to hear from someone who's "been there".

Cheers
Philip


>
>> My constraints:
>> - Need to support Linux and Windows
>> - I'll be developing under OS X (thank you VirtualBox!)
>> - Using wxPython, scipy, numpy, SWIG
>> - Code will eventually be open sourced
>>
>> Thanks
>> Philip
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>>
>
>




More information about the Python-list mailing list