
This may potentially be unrelated to Boost.Python, but how to do an equivalent of C++ dynamic_cast in Python, having all the classes wrapped using boost.python? See below: // All the components inherit from Component class Component { }; class ComponentA: public Component { }; class ComponentB: public Component { }; // Find a component by name Component *FindComponent(const char *name); // In C++ result of FindComponent may be dynamic_casted to appropriate type: void f() { Component *c = FindComponent("a"); ComponentA *a = dynamic_cast<ComponentA *>(c); } How to do this in Python (all Component classes are wrapped)? def f(): c = FindComponent("a") # Unforunately Python sees c as an instance of Component, not as ComponentA which it really is a = ??? Thanks, Marcin