On Jan 31, 2008 9:49 AM, nathan binkert <[EMAIL PROTECTED]> 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/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com