
Congratulations! You have chosen Python as the next language to learn. Python is a language that is extremely dynamic, versatile, easy to use and easy to read. But you knew this already, right? Well, no matter the reason for choosing Python the first thing a rookie coder usually asks is which version of Python should I use and why? That is a very good question as it will dictate how you learn and use the language going forward. It was also a question I asked myself when I started. Below I will attempt to answer that quandary as best as possible.
Python 2 has become what seasoned coders call “Legacy Python”. Much of the code that is out there now that is being used by companies has been programmed using Python 2. You have to remember that Python as a whole has been around for over 20 years. So there is going to be a lot of code floating around out there. For someone who is either trying to up their skills for their current job or looking to get into a sector that has been using Python for a long time and you need to maintain their code, Python 2 is probably the better fit. One thing to remember though it that Python 3 is slowly becoming the dominating version.
Python 3 first started being used in 2008 and has become the preferred version for new developers. Many companies have begun the process of updating their code to Python 3 for this reason. There have been a lot of updates within the language as well as the supporting libraries helping make Python 3 the goto choice. Python 3 takes many elements of Python 2’s structure and makes them more efficient and easier to use and read. Some items are “baked” directly into the language itself instead of needing a separate library to support your code. An example of this is Regular Expression. These items were not included with Python 2 and usually needed some extra setting up in order to make them work.
So wait, now you’re telling me I have to learn two languages just to code in Python proficiently? Absolutely not. The great thing about Python is that no matter what version you decide to focus on the other version can still work with a few tweaks. You inherently learn the basics of one version while learning the other. Many elements of Python and programming languages in general can transcend. An example of that is Object Oriented Programming. No matter the version you use, classes and objects should be set up the same way.
I started coding in Python about 3 years ago at the tail end of the debate and started with Python 2 due to the fact that most applications at that time were using it. Now since I have learned more and use the language more, I solely code in Python 3. Partly because there is more support for the areas I am coding in through standard libraries and the code itself but mostly because all of my code will be used now in a developing Python 3 environment. None of the code I am producing today will ever have to fit into a Python 2 environment. So for me, why would I use Python 2 except for very particular reasons?
The simple answer is, if you are starting out using Python now and are looking to use it for future applications then my suggestion would be to focus on Python 3 but be aware of Python 2 and it’s dependencies. If you are looking to learn Python in order to work for a company that needs you to maintain old code, then Python 2 would be a primary focus but I would also code new applications in Python 3.
Ultimately it is your choice and it is definitely a choice that will steer your learning and output. The best advice that was given to me was: “Figure out what you want to do with the language and start there… but know that Python 3 will soon be the normal.” Sage advice, don’t you think?
Photo by Tim Gouw from Pexels https://www.pexels.com/photo/man-in-white-shirt-using-macbook-pro-52608/
Congratulations @jabbyj! You received a personal award!
Happy Birthday! - You are on the Steem blockchain for 1 year!
Click here to view your Board
Congratulations @jabbyj! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!