I’m not all that familiar with Phyton, but since Jython ,which is the Java implementation of Phyton, is the preferred scripting language for WebSphere I do need to dive into it now and then. Today I needed to check if input parameter to a script was equal to a given value, then check a property file for the corresponding key/value pair. If key/value pair not present then check if the common default value where there. If if all is false, then just break out of the script.
As you might have figured out this will get a bit messy, so I thought that maybe a switch-case statement could help me out to make it a bit cleaner. First I found this article at Bytebaker switch-case-statement-in-python showing a “fake” implementation of swich-case, since it turns out that Phyton does not have this functionality. “Yes!!!”, but then it turned out no…I read the comments to the post and at the end found the follow-up article “Switch-case statement in Python revisited“. So back to square one again…