I have an existing python script that, among other things checks a file against a dictionary of regular expressions. If the file contains one of the regular expressions, I note that a dictionary hit has been made, print the line that contains the file and move on. Pretty simple.
However I now want to establihs a different callback function for each RE the file has a hit against. I'm puzzled as to how this can be accomplished in python outside of a long if/elseif block. Is this a case where this should be done in PERL instead? (This means I have to re-write quite a bit of code, hence the reason for not doing so in the first place).
I've checked these out (even the links in the posts) for possible work-arounds but have yet to see anything that might work:
Replacements for switch statement in Python?
https://stackoverflow.com/questions/374239/why-doesnt-python-have-a-switch-statement