Python Python 2.7.3 or 3.4.1? Which to Learn for Physics/Math

  • Thread starter Thread starter Cake
  • Start date Start date
  • Tags Tags
    Python
Click For Summary
When learning Python, the choice between Python 2.7 and Python 3.x is significant, especially for applications in physics and mathematics. Codecademy currently teaches Python 2.7.3 due to its backward compatibility issues with Python 3, which may affect the availability of libraries. However, Python 2.7 and Python 3 share many foundational concepts, making it feasible to transition from 2.7 to 3.x with relative ease. It is suggested that beginners start with Python 2.7 to access a wider range of libraries, particularly for scientific programming, as many essential libraries have not yet been fully ported to Python 3. The Anaconda distribution allows for easy switching between Python versions, which can be beneficial for learners needing specific libraries. Ultimately, if compatibility with existing libraries is a concern, Python 2.7 is recommended; otherwise, Python 3.x can be used for newer projects.
Cake
Messages
100
Reaction score
16
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?
 
Technology news on Phys.org
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.
 
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.
 
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.
 
If you need 2.x for compatibility with libraries, use that. Otherwise use 3.x.
 
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 9 ·
Replies
9
Views
10K
  • · Replies 397 ·
14
Replies
397
Views
20K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 6 ·
Replies
6
Views
13K
  • · Replies 6 ·
Replies
6
Views
4K