Which Python is for me?

You may have heard people talking about different versions of Python and be a bit confused by it all, not to worry. We are here to set you straight and help you choose the right Python for use with your PiFace.

Difference between Python3 and Python

There are two major versions of python that are in common use today, Python 3 and Python 2 (which is simply known as Python). Python 2 is the most widely used of these two though the Python community has been moving towards python 3 more and more. The issue is that their is limited forwards and backwards compatibility between these two versions of Python, so most Python 2 files have to be ran with the Python command and Python3 files with the Python3 command. This can be a problem if you are wanting to use multiple packages that only has releases for the different versions of Python.

Which should I use?

We have develop python 2 and 3 versions of the PiFace Digital software to facilitate a wider range of compatibility with other Python modules. If you are using other modules in your PiFace programs, you should check which versions of Python your modules have releases for and choose the Python that is most compatible with your needs, for example, the Pygame module that is often used in RaspberryPi Python programs is currently only available as a Python 2 release. If you have no Python version specific modules and you are new to Python, then it is probably best to start with Python 2 as there are more guides and tutorials referring to it. Once you have picked your poison, make sure you are clear on the nuances of your version.

Example difference

One of the differences between the Pythons is the print statement:
Python 2print “Hello world!”
Python 3print (“Hello world!”)

There are many subtle differences between the Pythons and it is good to be aware of them.