@@ -8,31 +8,35 @@ meta: Learn about whether you should use Python version 2 or 3 to build your app
88
99
1010# Python 2 or 3?
11- The Python programming language is currently in the midst of a long-term
12- transition from version 2 to version 3. New programmers typically have many
13- questions about which version they should learn. It is confusing to hear
14- that Python 3, which was originally released in 2008, is still not the default
15- installation on some operating systems.
16-
17- The simple answer is: learn Python 3, specifically the latest version
18- which as of May 2018 is [ Python 3.6.5] ( https://www.python.org/downloads/ ) .
19- If for some reason you absolutely have to learn Python 2, for example because
20- your employer is working on a bunch of legacy code, you will be able to
21- transfer the majority of your knowledge from Python 2 right into Python 3.
22- Likewise, you will still be able to read and write Python 2 code if you
23- start with Python 3.
24-
25- In addition, my personal strong recommendation for new programmers as of
26- right now is to use Python 3. There are
27- enough [ great resources] ( /best-python-resources.html )
28- out there that teach version 3 from the ground up. Python 3 is the future
29- and you will not regret starting with the latest version of the
30- programming language.
31-
32- However, if you are interested in DevOps-type work with
11+ The Python programming language is almost finished with a long-term transition
12+ from version 2 to version 3. New programmers often have questions about which
13+ version they should learn. It can be confusing to hear that Python 3, which was
14+ originally released in 2008, is still not the default installation on some
15+ operating systems such as macOS. However, that situation is rapidly changing
16+ as the final version 2 release, Python 2.7, is approaching its end-of-life
17+ that is definitively scheduled for
18+ [ January 1, 2020] ( https://mail.python.org/pipermail/python-dev/2018-March/152348.html ) .
19+
20+ The simple answer right now is: learn Python 3, specifically the latest
21+ version which as of May 2018 is
22+ [ Python 3.6.5] ( https://www.python.org/downloads/ ) . If for some reason you
23+ absolutely have to learn Python 2, for example because your employer is
24+ working on a bunch of legacy code, you will be able to transfer the majority
25+ of your knowledge from Python 2 right into Python 3. Likewise, you will
26+ still be able to read and write Python 2 code if you start with Python 3.
27+
28+ There are enough [ great resources] ( /best-python-resources.html )
29+ out there that will teach you to code in version 3 without any prior
30+ version 2 experience. Python 3 is the future and you will not regret
31+ starting with the latest version of the
32+ [ programming language] ( /learning-programming.html ) .
33+
34+ One caveat to the recommendation to go full-on Python 3. If you are
35+ interested in DevOps-type work with
3336[ configuration management tools] ( /configuration-management.html ) such as
34- [ Fabric] ( http://www.fabfile.org/ ) , then you may have to use both Python 2
35- and 3 because some of the libraries are lagging in full Python support.
37+ [ Fabric] ( http://www.fabfile.org/ ) or [ Ansible] ( /ansible.html ) , then you
38+ may have to sometimes use both Python 2 and 3 because parts of these
39+ libraries are lagging in full Python 3 support.
3640
3741
3842### Visualizations and Projects
@@ -48,9 +52,9 @@ the community, many projects have sprung up to make the transition easier.
4852 used with Python 3.
4953
5054* The [ Python clock] ( https://pythonclock.org/ ) counts down the time until
51- Python 2.x is no longer maintained. While in 2016 Python 2's retirement
52- may seem a long time away, it can take a lot of time and effort to migrate
53- existing application to the modified syntax in 3.x.
55+ Python 2.x is no longer maintained. While Python 2's retirement
56+ may still seem a long time away, it can take a lot of time and effort to
57+ migrate existing application to the modified syntax in 3.x.
5458
5559
5660### Porting to Python 3 resources
@@ -81,38 +85,61 @@ gone through the process and have advice for making it less painful.
8185 deploying the new version before going back to clean up unnecessary code
8286 created by the transition.
8387
84- * [ he only problem with Python 3's str is that you don't grok it] ( http://sircmpwn.github.io/2017/01/13/The-problem-with-Python-3.html )
88+ * [ The only problem with Python 3's str is that you don't grok it] ( http://sircmpwn.github.io/2017/01/13/The-problem-with-Python-3.html )
8589 specifically covers strings and some of the misconceptions around
8690 how strings are handled in version 2 versus version 3.
8791
92+ * [ Migrating to Python 3 with pleasure] ( https://github.com/arogozhnikov/python3_with_pleasure )
93+ is a porting guide that focuses on code that data scientists would
94+ typically use in their programs.
95+
96+ * [ Instagram Makes a Smooth Move to Python 3] ( https://thenewstack.io/instagram-makes-smooth-move-python-3/ )
97+ explains their upgrade process for getting all of their code over to
98+ Python 3 compatibility over a period of about a year.
99+
100+ * [ Practical steps for moving to Python 3] ( https://talkpython.fm/episodes/show/155/practical-steps-for-moving-to-python-3 )
101+ is a podcast episode that goes over migrating a large existing application's
102+ codebase to Python 3 from Python 2.
103+
104+ * [ Lessons learned from migrating to Python 3] ( https://able.bio/rhett/lessons-learned-from-migrating-to-python-3--27jsj82 )
105+ covers how a development team with a large e-commerce site built on
106+ [ Django] ( /django.html ) was able to upgrade their project.
107+
88108
89109### Python 2 to 3 resources
110+ The following resources will give you more context on how the community
111+ feels the transition from Python 2 to 3 is going, as well as why you
112+ should upgrade as soon as possible.
113+
90114* [ Why should I use Python 3?] ( https://eev.ee/blog/2016/07/31/python-faq-why-should-i-use-python-3/ )
91115 is a detailed FAQ on important topics such as unicode support, iteration
92- improvements and async upgrades provided by 3.x.
116+ improvements and async upgrades provided by 3.x. There is also a great
117+ follow up post by the author titled
118+ [ A Rebuttal For Python 3] ( https://eev.ee/blog/2016/11/23/a-rebuttal-for-python-3/ )
119+ that counters some arguments made by other community members who are
120+ unhappy about various features in Python 3.
93121
94122* Want to know all of the advantages and what's changed in Python 3
95123 compared to Python 2? There's
96124 [ an official guide to Python 3 changes] ( https://docs.python.org/3/whatsnew/index.html )
97125 you'll want to read.
98126
99- * [ Why Python 3?] ( http://whypy3.com/ ) randomly outputs valid reasons to
100- use Python 3 over 2.x.
101-
102- * [ Python 3 in 2016] ( https://hynek.me/articles/python3-2016/ ) explains
103- that many newer Python developers have only used Python 3 and as that
104- cohort continues to grow it will have an outsized impact on further
105- adoption.
106-
107127* [ Python 3 is winning] ( https://blogs.msdn.microsoft.com/pythonengineering/2016/03/08/python-3-is-winning/ )
108128 presents data and graphs from PyPI to show that at the current rate,
109129 by mid-2016 overall Python 3 library support will overtake Python 2
110130 support.
111131
132+ * [ Python 3 Retrospective from the Benevolent Dictator for Life ] ( https://www.youtube.com/watch?v=Oiw23yfqQy8 )
133+ is a talk by Guido van Rossum on what is working, not working and still
134+ needs to be done before the changover can be considered complete.
135+
112136* [ The stages of the Python 3 transition] ( http://www.snarky.ca/the-stages-of-the-python-3-transition )
113137 provides perspective from a core Python developer on how the transition from
114138 Python 2 to 3 is going as of the end of 2015.
115139
140+ * [ Why Python 3?] ( http://whypy3.com/ ) randomly outputs valid reasons to
141+ use Python 3 over 2.x.
142+
116143* [ Rules for Radicals: Changing the Culture of Python at Facebook] ( https://www.youtube.com/watch?v=nRtp9NgtXiA )
117144 is a fascinating look at how Facebook moved from primarily Python 2
118145 up to Python 3 due to the efforts of a small passionate group of
@@ -144,3 +171,5 @@ gone through the process and have advice for making it less painful.
144171 is a great slideshow with code snippets that show useful new features
145172 of Python 3 that are not available in 2.x such as keyword-only
146173 arguments, chained exceptions and the ` yield from ` keyword.
174+
175+
0 commit comments