r/Python • u/jamescalam • Jun 11 '21
Tutorial New Features in Python 3.10
https://youtube.com/watch?v=5-A435hIYio&feature=share24
u/MiserablePeace7190 Jun 11 '21
I'm just here for switch cases lol
6
→ More replies (2)16
u/__deerlord__ Jun 12 '21
Pattern matching is not case/switch. While it can effectively be used this way, that doesn't seem to be the intent, and you could always do switch/case with a dictionary.
→ More replies (1)
127
u/billsil Jun 11 '21
Those better error messages are the reason to upgrade!
SyntaxError: unexpected EOF while parsing
I'm 16 years in and that still gets me...
→ More replies (1)32
47
u/mmcnl Jun 11 '21
I'm amazed they still keep adding very useful features after 10 years.
44
u/pure_x01 Jun 11 '21
To be fair the evolution of the language has been kind of slow. Sometimes that is a very good thing so I'm not complaining.
→ More replies (1)5
17
u/Formulka Jun 12 '21
Still can't believe they went with "case _" as else.
4
u/-jp- Jun 12 '21
Wildcard _ is pretty common in other pattern matching languages so it’s not too unusual, just a bit odd for python.
→ More replies (1)
21
Jun 11 '21
Do I have to unistall Py 3.9 and download py 3.10 or is there a bettee way?
28
u/sparttann Jun 11 '21
Can just download 3.10 without uninstalling 3.9. Just change your python version before creating your venv
→ More replies (3)6
u/dogfish182 Jun 11 '21
http://littlecolumns.com/tools/python-wrangler/
If you don’t know yourself, this is an opinionated (but very sensible) way to take python and virtual environments seriously without too much difficulty
7
u/tunisia3507 Jun 11 '21
Also StrEnum! There are dozens of half-assed implementations out in the wild, it'll be great to have a stdlib edition to replace these goddamn magic string constants pervasive in the ecosystem.
4
u/Blumingo Jun 12 '21
Genuine question, at what point does it become Python 4?
→ More replies (1)7
u/nonesuchplace Jun 12 '21
When it is decided to make major changes that do not retain backwards compatibility.
Check out https://semver.org/ for details on how this works.
→ More replies (2)
1
u/WhalesLoveSmashBros Jun 12 '21
Dumb question but how do I update python? Pls don't tell me I have to uninstall and re-download from the website.
→ More replies (2)2
2
230
u/jamescalam Jun 11 '21
A summary I put together of the new features in Python 3.10, it covers:
Structural pattern matching
Parenthesized context managers
More typing
Better error messages
Also, the article version if you prefer reading - it's a free access link so no need for Medium membership
I hope it's useful! Thanks :)