Pure virtual functions in Python?

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Feb 21 18:42:53 EST 2010


lallous wrote:
> If the base defines the method and it was empty, then my C++ code
> would still call the function. This is not optimal because I don't
> want to go from C++ to Python if the _derived_ class does not
> implement the cb.

I would simply not implement the method at all in the base
class. Then the C++ code can do an attribute lookup for
the method, and if it's not found, do nothing.

-- 
Greg



More information about the Python-list mailing list