Recently I was working on a server maintenance project, which involves loads of remote interactions through several different protocols such as ssh, mosh, telnet, snmp, etc. To implement such an application often need let your code branching through several functions. I really hate to write loads of
ifs in my code especially in Python, which identify blocks by indentation. My solution is to call each functions by its string-type name. An example is as follows.
def _ssh(hostname, port):