On 4/18/05, Andrew Wilkinson <[EMAIL PROTECTED]> wrote: > I'm trying to wrap a C++ class hierarchy with Python types and I'd like to > maintain the hierarchy in the types. I'm fairly sure this is possible, > isn't it?
Yes. > Are there any documents explaining how to do this, the standard Python > manual doesn't go into enough detail about creating types for this. Amen. > I've found the tp_base and tp_bases elements and I've set them to the base > type object (and a tuple containing the base type object) before I call > PyType_Ready but in Python the base class isn't recognised. Is there > anything obvious I'm missing? Well, I can't really recommend without seeing what you did (did you remember the preceding "&" for the type struct? Otherwise, I'd have to recommend Objects/unicodeobject.c in the Python source as a reference for how to do this. I've had a couple of questions about how to implement new types that I posted to the list, and never got much help, so I started using the Python source as a reference. I've gotten most of what I needed to know from there. HTH -- Steve Juranich Tucson, AZ USA -- http://mail.python.org/mailman/listinfo/python-list