Python 2 or 3

Gelonida N gelonida at gmail.com
Sat Dec 3 15:59:40 EST 2011


On 12/03/2011 04:54 AM, Antti J Ylikoski wrote:
> 
> I'm in the process of learning Python.  I already can code
> objet-oriented programs with the language.  I have in my hands the
> O'Reilly book by Mark Lutz, Programming Python, in two versions: the
> 2nd Edition, which covers Python 2, and the 4th edition, which covers
> Python 3.
> 
> In the "official Python site" so to speak, http://www.python.org, it
> is mentioned that the authors recommend the visitor, who is a novice,
> to learn Python 2 rather than Python 3, because most of existing
> software has been writen with Python 2.
> 
> The O'Reilly book has some 1200 pages.  I would not want to invest
> such an amount of work and time to an obsolete language (i. e. Python
> 2).
> 
> What is the opinion of the wizards here, shall I learm Python 2 or
> Python 3?  I'm posting this here because I feel that this point is
> interesting to other students of Python.
> 
> 
> Cheers, Antti "Andy" Ylikoski
> Helsinki, Finland, the EU

I would still stick with python 2.

In my opinion there is no reason to rush to the most recent version.

Especially when working in a corporate environment or when being obliged
to use certain web servers / servers  you will notice, that
you will still encounter quite some hosts with python 2.5 and even some
with python2.4.

Most machines, that I have to use,  run python 2.6  (and some python
2.5) I personally try to write most of my code such that it could still
run with python 2.5  I decided that python2.4 is my cut-off point,
though I still have one machines and some embedded devices, which just
run 2.4


Other considerations

- there are still more libraries / packages available for python
   2 than for python 3, though this is changing.

- if you write code nicely enough in python 2, then you can translate it
  to python 3. autmatically. However up to my knowledge you
	cannot automatically translate python 3 code to python 2 code.

With that strategy your code will be able to run on most web servers and
your own machines.



If you want to write your own code which does not have to run on other
machines and / or if you want to heavily use unicode, then it might be
better to start with Python 3.




More information about the Python-list mailing list