DEV Community

Ben Halpern
Ben Halpern

Posted on

What is the state of Python versions?

Python 2, Python 3...

I'm a bit out of the loop on the latest. Can folks fill us in on what's going on in terms of different Python versions, what to look out for in the future?

Oldest comments (19)

Collapse
 
anujdevrani profile image
Anuj Devrani

Python 2 is effectively dead. It has lost official support from 01/01/20. Consider using python 3.6+ for all future projects.

' The master king is dead...long live the king '

Collapse
 
ferricoxide profile image
Thomas H Jones II

Lulz... My RHEL6 customers recently started complaining, "nothing works with our Python, any more." Trying not to sarcastically reply, "you do remember all the emails we sent saying that RHEL6 reaches full de-support come the end of November 2020, right? You need to get off that RHEL6 stuff, like, yesterday" has been challenging.

Collapse
 
rhymes profile image
rhymes

Python 2 consultants will make good money this year and the next :)

Thread Thread
 
deciduously profile image
Ben Lovy

And the next...

Thread Thread
 
ferricoxide profile image
Thomas H Jones II

...But COBOL programmers will still be going strong long after Py2 coders have massaged their last bits of deployed code.

Collapse
 
douglasjreynolds profile image
Doug Reynolds

I think that RHEL is on the hook supporting Python 2.7 with its customers until EOL of RHEL 7. Yum and the base RHEL utils all use 2.7. If they need Python 3 on RHEL 6, Software Collections works just fine.

Collapse
 
jheld profile image
Jason Held

Py3.6 is likely your base target, feature wise. 3.7 has some improvements and more features but 3.6 still has more explicit support. However they are mostly compatible. 3.8 is the newest. 3.9 is in alpha.

If you're looking for asyncio support you would really need 3.5+, but ideally 3.6+.

Good type hint/annotation support is really 3.6+, though 3.5 has some support.

3.6+ has f-strings (f"hi {name}").

3.7 has official built in dataclass support (3.6 has a PyPI package), which is for helping reduce class boilerplate but also helping with memory management.

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

And 3.8 has those ever-so-controversial (but adorable) walruses. ;)

My own recommendation is for new projects to support Python 3.6 through 3.8, as much as is practical. Python 3.7 is a good "middle ground", as it's available on most (if not all) modern operating systems. Ubuntu 19.04 and onward use 3.7 as the base version, and don't even ship 3.6.

And, of course, Python 2 is at official End Of Life, and thus should be considered dead for all practical intents and purposes.

Collapse
 
douglasjreynolds profile image
Doug Reynolds

Python 3.7 is my version of choice. 3.8 doesn't really have anything I need, except for the walrus, and 3rd libraries take a while to add support. 3.7 also had a good deal of performance improvements over 3.6.

I am waiting for 3.9 before leaving 3.7

Collapse
 
rhymes profile image
rhymes

Python 3.7 or 3.8 is the way to go :D

Python 2.x is officially unsupported starting January, though they pushed the sunsetting date to April: python.org/psf/press-release/pr201...

Collapse
 
delta456 profile image
Swastik Baranwal

Python 2 support is gone and you should use Python 3.7 or 3.8 instead.

Collapse
 
jefftriplett profile image
Jeff Triplett (he/him)

Python 3 is mainstream and Python 2 is effectively retired. There is one more release coming in April, but the code has been frozen, and it's no longer supported.

If I'm starting a new project, I use Python 3.7 which is also my system-wide default.

If I'm working on a community library, test against 3.6, 3.7, and 3.8.

Once Python 3.8.2 or 3.8.3 is out (currently on 3.8.1), I'll switch my system-wide default over to it.

Collapse
 
sm0ke profile image
Sm0ke

Py2 hits the EOL on 01/01/20. Py3 is recommended for future projects.

Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦

💀💀💀💀 PY2 💀💀💀💀

Collapse
 
mendoza profile image
David Mendoza (He/Him)

For me the best one right now, 3.7.x most of the time linux comes with it right of the bat too

Collapse
 
delta456 profile image
Swastik Baranwal

Walrus operator

if (name := 20) > 30:

Collapse
 
ahmed2m profile image
Ahmed Mohamadeen

I believe this is only supported in Python 3.8+ ?

Collapse
 
highcenburg profile image
Vicente G. Reyes

Better if you get your system at Python 3.7 globally.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I try to use Python 3.8 for my projects since I use Type Annotations on everything now. 3.8 has a lot better support than 3.7 does.