Upgrade to Python 3.10 to use match statement. #206
Replies: 2 comments 4 replies
-
Good find! 👍
However, the filters should be functions that return callables ( |
Beta Was this translation helpful? Give feedback.
-
I actually had added a switch case with 3.10, but didn't end up using it more than like 2 places. So I reverted it in favor of more compatibility, since it didn't really save all that much space or add too much readability |
Beta Was this translation helpful? Give feedback.
-
Python finally added a very powerful switch statement called match in version 3.10, which released a few months ago. Are there some dependencies holding back on the version, or could this project upgrade to 3.10?
The match statement will simplify a lot of if,elif,else chains, of which there are many, so this would be the perfect application.
An example:
becomes:
The end result are minor performance gains as well as greater ease reading and writing this code.
Beta Was this translation helpful? Give feedback.
All reactions