|
|
|
|
|
by jimminy
1726 days ago
|
|
Yeah, I think the author focused a bit too much on structural pattern matching being a replacement/alternative for if...elif blocks. It will be much more useful as an alternative to dispatch dictionaries, which are more a side-effect of the language lacking any case based control-flow. |
|
Though considered from that perspective, it’s actually a bit of a disadvantage that the new match statement is a part of the language. It’s nice to dynamically extend (either as a first party developer or third party user) that sort of dictionary, effectively adding new branches to the implicit switch statement. A match statement is going to be fixed as written. Probably a readability and consistency win to remove spooky-action-at-a-distance, but at the cost of a bit of (ugly, pragmatic) usability