Python 3.10 refactor in the far-off future: Structural Pattern Matching #2016
Replies: 2 comments 4 replies
-
Sorry to disappoint, but I don't see this feature ever being used in gallery-dl, at least not while there are still people using Windows 7. The last Python version that runs on Win7 is 3.8 and I plan on using that as the new minimum required version for gallery.dl v2 (currently it's Python 3.4). Language features not supported by that version therefore can't and won't be used, same as there are currently no f-strings and walrus operators in gallery-dl. On a personal note, I don't really see the appeal of Structural Pattern Matching and why it needs 4 PEP documents (622, 634, 635, 636) for what are basically fancy
There was a reason to use |
Beta Was this translation helpful? Give feedback.
-
Normally I don't like to hop on the bandwagon for the latest Python, I tend to lag at least one or two versions behind while I wait for things to update, but Python 3.10 introduced a real game-changer in my opinion: Structural Pattern Matching
Or, in other words, the sort of switch-case statement that a ton of other programming languages have (though they don't actually use the word 'switch' in their implementation). Honestly, it's long overdue.
This article gives a more in-depth summary of its capabilities: https://towardsdatascience.com/more-advanced-pattern-matching-in-python-3-10-2dbd8598302a
Given all the different conditionals that go into every extractor, this seems like it would simplify things greatly. Worth noting that while it doesn't seem like it's possible to backport, the switch-case module could be a potential stand-in. It may be good to plan for the future.
Beta Was this translation helpful? Give feedback.
All reactions