class _Example(object):

    def __init__(self, doSomething, doSomethingElse):
        self.doSomething = doSomething
self.doSomethingElse = doSomethingElse
ExampleStore = {}

def register(type1, type2, instance):
    ExampleStore[type1, type2] = instance

def doSomething(a, b):
    types = type(a), type(b)
return ExampleStore[types].doSomething(a, b)

def doSomethingElse(a, b):
    types = type(a), type(b)
return ExampleStore[types].doSomethingElse(a, b)

def Example(type1, type2, doSomething, doSomethingElse):
    register(type1, type2, _Example(doSomething, doSomethingElse))
__all__ = ['doSomethingElse', 'doSomethingElse', 'Example']
From Haskell to functional Python