On Jan 31, 2008 9:49 AM, nathan binkert <nate at binkert.org> wrote: > Another thing about monkeypatching is that it seems like the best way > to write an extension class where you want half to be in C/C++ and > half in Python. I'm in the middle of working on such a class and > there are plenty of members that just don't need to be in C++. > > Is there a better/preferred idiom for such a thing? I don't want to > subclass my new class because I want any objects created on the C++ > side to also get the python methods. Have you tried this? I believe it doesn't even work; types defined in C++ are supposed to be immutable. Try adding a new method to list or dict. However the C++ side should be able to create instances of the Python-defined subclass as long as it runs in a method, since it has a reference to the actual class. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4