Use the abc module to fake inheritance
The abc module allows to override isinstance() and issubclass(), and that's what we need to solve our illogical inheritance trees. Reminder: RenderWindow doesn't inherit from both Window and RenderTarget because both are native classes (written in C++).
But it seems that in Cython overriding __metaclass__ has no effect so I asked on the mail list for the Cython equivalent of :
from abc import ABCMeta
class MyABC:
__metaclass__ = ABCMeta
MyABC.register(tuple)
assert issubclass(tuple, MyABC)
assert isinstance((), MyABC)
https://groups.google.com/forum/#!topic/cython-users/zXroGWufF4U
Once solved, you'll get the following output.
w = sf.RenderWindow(...)
isinstance(w, sf.RenderTarget) # true
issubclass(w, sf.RenderTarge) # true
Same for our transformable drawables which inherit from sf.Drawable and not sf.Transformable.
From the linked thread:
Right, metaclasses are supported for normal python classes only. cdef classes are pretty special with a number of restrictions compared to normal classes.
Not so promising :-( Should we investigate alternatives?