Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Python Python 2.7.3 or 3.4.1?

  1. Jan 8, 2015 #1
    I have a book for learning python that teaches it with python3 in mind. I also have been using codecademy.com to learn in a more structured way. The thing is that codecademy teaches python from when the most recent form of python was 2.7.3. Their reasoning behind this is that python3 isn't very backwards compatible so they're teaching 2.7.3 for now. If you were learning python for physics and mathematics programming, which version would you learn?
  2. jcsd
  3. Jan 8, 2015 #2


    User Avatar
    Gold Member

  4. Jan 8, 2015 #3


    User Avatar
    Education Advisor

    Either way you'll be fine. The main purpose of initially learning how to code is to learn how python works. At the most basic level, python 2.7 and python 3 will work the same. If you want to be extra clever, you can follow the python 2.7 lessons and do it python 3. Thus teaching yourself the difference. However, as someone who knew python 2.7, teaching myself python 3 took a day at basic principles. A bit longer to get used to smaller modules, but the built in STAT modulo was nice.
  5. Jan 8, 2015 #4
    Yes, for a long time now, everybody keeps talking of waiting for the move until all scientific modules have been ported over to 3...but you don't need them all, just check to see which ones you need and if those have already been ported over or not.

    Lately, I learned of the Anaconda Python distribution...I liked it and install it; from the documentation, one can tell that it is fairly easy to switch between running 2.7 and 3.4 using conda.
  6. Jan 10, 2015 #5


    User Avatar
    Gold Member

    I would learn 2.7 just because there are a lot more useful libraries for it so far. I don't know how many times I started writing a program in 3.4.2 and then I had to convert the whole thing back to 2.7 just because there weren't any libraries to do what I wanted. Unless you are either going to be using really standard libraries without getting too technical, or you are up to writing whole new libraries for 3.4.2 (which you aren't since you are just starting out), I would recommend 2.7.
  7. Jan 15, 2015 #6
    If you need 2.x for compatibility with libraries, use that. Otherwise use 3.x.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook