Skip numpy __new__ in ndarray subclass (or possibly overriding/defining classes in C or cython)
问题 Ultimate goal: have isinstance(MyClass(), np.ndarray) and issubclass(MyClass, np.ndarray) both return True without MyClass calling np.ndarray.__new__() . Let's say I've implemented all the methods of numpy.ndarray and I want to set it up so that it will pass isinstance checks for ndarray , but I don't want it to actually call __new__ from ndarray . Initially, I was thinking of something like this: import numpy as np class BlockingClass(np.ndarray): def __new__(cls, *args, **kwargs): return