Musbur wrote:
Hello,

I have a function with a long if/elif chain that sets a couple of variables according to a bunch of test expressions, similar to function branch1() below. I never liked that approach much because it is clumsy and repetetive, and pylint thinks so as well. I've come up with two alternatives which I believe are less efficient due to the reasons given in the respective docstrings. Does anybody have a better idea?

I tried a lot of times to write down a useful Switch module
without convincing myself. Recently here is what I ended up
with, what do you think ?

https://gitlab.com/snippets/1921123


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to