Overloading methods in C API

Martin v. Löwis martin at v.loewis.de
Sat Jan 18 13:57:33 CET 2003


Phil Thompson <phil at river-bank.demon.co.uk> writes:

> So you have to implement it yourself by checking the types of the arguments 
> and calling the right overload, by which time you really need to be using an 
> automatic bindings generator to do it for you.
> 
> http://www.riverbankcomputing.co.uk/sip/ is my favorite. :)

That, of course, assumes that you really can perform the right
dispatching. For example, when dispatching from Python to C++, there
might be tricky issues, such as how to relate the many C++ integer
types to the two Python integer types. Some languages (e.g. C++) even
allow to define functions with a potentially unbounded number of
overloaded definitions (i.e. templates).

Regards,
Martin





More information about the Python-list mailing list