enigma2 icon indicating copy to clipboard operation
enigma2 copied to clipboard

Optimise `if`s - use `match... case` statements instead

Open wedebe opened this issue 2 years ago • 2 comments

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

wedebe avatar Oct 12 '23 21:10 wedebe

Probably even faster would be to use a dictionary.

Note that all the EPG code is currently being looked at for a major refactor.

IanSav avatar Oct 13 '23 05:10 IanSav

Link #3119

jbleyel avatar Nov 07 '23 16:11 jbleyel