3 ms·
Personally I find this a whole lot clearer. It's a table lookup, instead of a series of sequential checks (especially if you listen to your linter and have the
by Izkata 3y ago
Personally I find this a whole lot clearer. It's a table lookup, instead of a series of sequential checks (especially if you listen to your linter and have the elif version with the conditions and values on alternating lines, vs the conditions together in a vertical column like this).
- paulddraper 3y agoNot sure if this was the intent, but to anyone reading this....this dict doesn't have the perf benefits of a "table lookup"; in fact it's slower.
- Izkata 3y agoThe question was about readability, not performance.