enigma2
enigma2 copied to clipboard
Optimise `if`s - use `match... case` statements instead
Just noticed this elementary issue... if... if... if... if... if... statements all testing the same variable, not if... else if...
https://github.com/openatv/enigma2/blob/0362939424c4b1a883c0a15c0db83956776ebc81/lib/python/Screens/EpgSelection.py#L965
Suggest using match... case here and anywhere else there are multiple if statements being iterated needlessly.
https://stackoverflow.com/questions/66877130/what-is-the-syntactical-equivalent-to-switch-case-in-python/66877137#66877137
Probably even faster would be to use a dictionary.
Note that all the EPG code is currently being looked at for a major refactor.
Link #3119