ll_mat
is documented to be a function -- not the type itself. The idiom is known as "factory function" -- it allows a "creator callable" to return different actual underlying types depending on its arguments.
You could try to generate an object from this and then inherit from that object's type:
x = spmatrix.ll_mat(10, 10)
class ll_mat(type(x)): ...
be aware, though, that it's quite feasible for a built-in type to declare it won't support being subclassed (this could be done even just to save some modest overhead); if that's what that type does, then you can't subclass it, and will rather have to use containment and delegation, i.e.:
class ll_mat(object):
def __init__(self, *a, **k):
self.m = spmatrix.ll_mat(*a, **k)
...
def __getattr__(self, n):
return getattr(self.m, n)
etc, etc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…