Polymorphism
holger krekel
pyth at devel.trillke.net
Mon Aug 5 19:35:33 EDT 2002
I forgot to mention that you should better test
your code before you post it ...
[me]
> dispatch_dict = {
> int : HandleInt,
> str : HandleStr,
> list : HandleList
> }
>
> def polymorphic_func(arg, *otherargs):
> return dispatch_dict(type(arg)) (*otherargs)
def polymorphic_func(arg, *otherargs):
return dispatch_dict[type(arg)] (*otherargs)
of-course'ly yours,
holger
More information about the Python-list
mailing list