On Wed, Dec 3, 2008 at 9:56 AM, Martin Sandve Alnæs <[email protected]> wrote: > 2008/12/3 Johan Hake <[email protected]>: >> Btw, is there any special function that defines a class's isinstance >> protocol? >> If there was we could define our own __isinstancecheck__? > > You're insane. I'm happy to say there is no such thing. > (I think Python 3 adds some way of saying > "MyClass supports this protocol" without inheritance)
Turns out you're not alone... Python 2.6 has exactly this feature ;-) http://www.python.org/dev/peps/pep-3119/#overloading-isinstance-and-issubclass (But that can never be a workaround for missing C++ inheritance). Martin _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
