you can also create a dict with the classes themselves as keys, not necessarily the classnames
typefunc={
int:lambda x: x*2,
str:lambda s:'(*(%s)*)'%s
}
def transform (param):
print typefunc[type(param)](param)
transform (1)
>>> 2
transform ("hi")
>>> (*(hi)*)
here typefunc
is a dict that maps a function for each type. transform
gets that function and applies it to the parameter.
of course, it would be much better to use 'real' OOP