Python: I Hate Long If-Elif Chains: This Design Pattern Solved It Once and For All
- ArjanCodes
- https://www.youtube.com/watch?v=g7EGMWvJ1fI
- Notes:
- Changes if-else chains into a python dictionary
- Reminds me of the table driven method of SQL
- Shows a way to dynamically add new Python code when a new method is defined using a registry and decorator
- I wonder if I could ever need to dynamically add new stored procedures without editing the table
- Changes if-else chains into a python dictionary