Python: unable to inherit from a C extension.
Posted
by celil
on Stack Overflow
See other posts from Stack Overflow
or by celil
Published on 2010-04-04T04:02:30Z
Indexed on
2010/04/04
4:13 UTC
Read the original article
Hit count: 410
I am trying to add a few extra methods to a matrix type from the pysparse library. Apart from that I want the new class to behave exactly like the original, so I chose to implement the changes using inheritance. However, when I try
from pysparse import spmatrix
class ll_mat(spmatrix.ll_mat):
pass
this results in the following error
TypeError: Error when calling the metaclass bases
cannot create 'builtin_function_or_method' instances
What is this causing this error? Is there a way to use delegation so that my new class behaves exactly the same way as the original?
© Stack Overflow or respective owner