On 02/11/2012 04:15 PM, Paul-Cristian Manta wrote:

I don't think it's impossible to set a metaclass of another class with
Boost.Python. The trick is actually pretty similar to the one above.

 >>> class Foo:
...    pass
...
 >>> Foo = FooMeta(Foo.__name__, Foo.__bases__, dict(Foo.__dict__))

You first define the class in Boost.Python as you normally would, then
do the equivalent of the code above. This should work, unless, of
course, there's some subtle detail I'm not aware of.


Ah, yes. I see what you're talking about now. You'll probably need to have FooMeta inherit from the Boost.Python metaclass and delegate to its __call__ to make sure the Boost.Python metaclass gets to do its magic too. But I think that ought to be enough to make it work.

Good thinking - glad you didn't get discouraged by my pessimism!

Jim

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to