0

I want to add method for one class implemented by C

from lru import LRU
class A(LRU):
    def foo(self):
        print("a")

lru is a lib from https://github.com/amitdev/lru-dict

error:“type ‘type’ is not an acceptable base type”

2
  • if you compile LRU by yourself, then you could use: ctypes.cdll.LoadLibrary() to load the library. Not sure if this works, but worth the try! Commented Mar 27, 2023 at 11:26
  • @bert I just want to make thing simple by using packed python wheel,Could you explain why the class implement by C can't be inherited? Commented Mar 28, 2023 at 5:49

1 Answer 1

0

Writing Python's inheritable C/C++ types is contained in this PEP 253. Also, you have this guide that explains how to write inheritable types in C/C++.

Sign up to request clarification or add additional context in comments.

1 Comment

This is basically a link-only answer, which is frowned upon on Stack Overflow. It would be better to explain why this type isn't inheritable, and refer to the PEP or guide if needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.