On 02/07/2012 01:35 AM, paulcmnt wrote:
The Python C API has the `PyObject *PyType_Type` object, which is equivalent to `type` in the interpreter. If I want to define a metaclass in C++, how can I set `type` as one of its bases in Boost.Python? Also, what other things should I take into consideration when defining a Python metaclass in C++? It'd be ideal if there was a Boost.Python solution to this. If not, a solution that uses the Python C API (or a combination of Boost and the C API) is good as well. (The version I'm using is Python 3.)
I'm afraid this isn't really supported. All Boost.Python classes have to use a specific Boost.Python metaclass that's defined deep in the bowels of some Boost.Python source file, and there's really no way to override that at present.
This might be a nice feature for the future, but I haven't thought too deeply about how to make it work or why one would want to do it. If you have a specific use case for a custom metaclass, I'd love to hear what it is.
Jim _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig