Readable switch construction


Version: 1.7
Category:
Scripts
Python
Requirements:
Seller:
Price:
-
System:
Rating:
4.4
License:

Description - Readable switch construction



Python`s lack of a `switch` statement has garnered much discussion and even a PEP. The most popular substitute uses dictionaries to map cases to functions, which requires lots of defs or lambdas. While the approach shown here may be O(n) for cases, it aims to duplicate C`s original `switch` functionality and structure with reasonable accuracy.



More in Python-Readable switch construction

Readable Switch Construction Readable Switch Construction