Python 2 vs. Python 3

Hi,
I am beginning to play with python in combination with ROOT, and have a question. Which version of Python should I start with? Python 2 (2.7.1) or Python 3 (3.1.3)? Which version is supported by ROOT? Or maybe it does not matter?

   Many thanks. 

-Arun

Arun,

the choices between python2.5 through python2.7 don’t really matter. I’d recommend python2.6, as that is what the LHC experiments use, and is therefore best supported.

There are quite some differences between p2 and p3, however, and whether they are worth it, is up to you. In particular, certain external libraries may still not be available for p3. If you do choose for p3, you should not use python3.0, but indeed python3.1 as you write, since the number of bug fixes between those releases has been rather large.

If you do use p3 with ROOT, use it with the latest release (5.28) or trunk. Either way, you’d have to build it from source as there are no binaries that are compiled with p3. Also, you would be (AFAIK) the third person to take up p3 with ROOT, so expect some teething problems (and I’d be happy to receive reports of those, so that they can be fixed).

Cheers,
Wim

Thanks a lot for the detailed reply, Wim.
Looks like I should stick with p2 for now.
-Arun

Why Move To Python 3?

The official end-of-life date for the Python 2 series is 2020 which means you have three years of support from the community. After that, you’ll have to find ways to get support for this series as new vulnerabilities can always arise. Since 2.7.13 is expected to be the last major release in the 2.7 series, new features won’t be backported, and only security and bug fixes will be going in from now until 2020. (ActiveState will continue to support the Python 2 series for a very long time, but new language features will be only available in Python 3.)