The python site details all the major differences bewteen versions. The really significant ones are the differences between python 2 and 3 in full detail, so if you’re deciding whether to work in python 3.0 or 3.1 or another version, it would be wise to check those out. Here’s a well-written evaluation of the major differences between 2 and 3, describing 2 and 3, respectively as:

Python 2.x is the status quo, Python 3.x is the shiny new thing.

While I’m not certain if programmers trying to run 2.x code in 3.x and getting syntax and runtime errors would consider that “upgrade” “shiny”, the language changes are in some ways significant and in other ways, trivial. I’ll present a small number of (fairly significant) changes that I’ve noticed here.

First off, one of the biggest is
The print command is now a function and in 3.2 must be coded as
or else the interpretor will throw an error.

print "word"
worked fine in 2.7, but throws and error in 3.2.

Then there are a bunch of smaller nuance things.

For example in 2.7:


But in 3.2, the range() function still works, but has a different way of displaying the result, namely, using upper and lower bounds:


commands like


in 2.7 have been changed in 3.2 as well.

There are many more minor and major significant changes but trying to run 2.7 code with a 3.2 interpretor/compiler will almost certainly result in a series of runtime and syntax errors. I’ve attempted doing some code-learning in a seperate 3.2 file. I have a file that I use to practice and write functions. The one that was coded in 2.7 generates an error practically every 3-4 lines if I try to interpret it via 3.2. While coding in 3.2 is interesting, most material is typically written for 2.7 (so for example, examples in books cease to functionally work if using 3.2), and 2.7 code throws errors, I’ll likely do most coding in 2.7. At the very least, it’s important to note that 3.2 requires practically a fresh .py and/or fresh set of functions because of the multitude of nuanced minor or trivial and major (like the print() function) changes to the language.

About these ads

About V.P.

meh meh.

3 responses »

  1. Glools Guan says:

    the most important difference between py2.7 and py3.2 is there are lots of libraries is supported py2.7, but less for py 3.2.

    • Okay but syntax is also different (notably with the print command). Also, why would a newer version support less libraries? To streamline the language? Seems like newer versions usually support more libraries. Do you know which major libraries that were supported in 2.7 are not supported in 3.2? cheers.

  2. pygame (something in relation to python that interests me) is a set of modules. lists some libraries. What constitutes a “library”?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s