Function Overloading and Python
Bruno Desthuilliers
bruno.42.desthuilliers at wtf.websiteburo.oops.com
Mon Feb 25 04:00:49 EST 2008
Allen Peloquin a écrit :
> I have a personal project that has an elegant solution that requires
> both true multiple inheritance of classes (which pretty much limits my
> language choices to C++ and Python) and type-based function
> overloading.
>
> Now, while this makes it sound like I have to resign myself to C++,
> which I am not a fan of writing, I have resisted thus far. Who wants
> to manage their own memory? No, I have fallen in love with Python, and
> so come asking for help.
(snip)
> Now, what are my options in Python to dispatch unique code based on
> the permutations of "type A" classes without code repetition?
There are at least a couple type- or rule- based dispatch packages or
receipes around. Googling for 'generic' or 'ruledispatch' etc... might
give you a start.
More information about the Python-list
mailing list