4 ms·
The "switch/case" statement is now in too (or match/case here, even though it goes beyond a simple case statement). It had been rejected by Guido before (see:
by AStrangeMorrow 5y ago
The "switch/case" statement is now in too (or match/case here, even though it goes beyond a simple case statement).
It had been rejected by Guido before (see: https://www.python.org/dev/peps/pep-3103/#rejection-notice https://www.python.org/dev/peps/pep-3103/#rejection-notice) but it seems it made its way in this time.
Approved: https://www.python.org/dev/peps/pep-0634/ https://www.python.org/dev/peps/pep-0634/
- joshuamorton 5y agoWorth mentioning that the PEP 275 switch statement is c-styleish, in that it only matches on constant values, while the PEP 634 version handles pattern matching and destructuring, making it a lot more powerful.