Hello,

I'd like to expose an std::map to Python.  I found a great example here:
https://sourceforge.net/p/cctbx/code/HEAD/tree/trunk/scitbx/stl/map_wrapper.h#l240

It implements a bunch of methods to make it act like a dict (hooray duck typing)
But I think it misses some like __eq__, __ne__, pop.

I think this could be done better by extending collections.MutableMapping.
This way you'd only have to implement the 5 abstract methods rather than the 20 
or so it currently does.
How can I do this?  Is it possible to define the parent class when creating a 
Python class from C++ using boost::python::class_?

I haven't been able to find a way.

Thanks,
~Eric

This message and any attachments are solely for the use of intended recipients. 
The information contained herein may include trade secrets, protected health or 
personal information, privileged or otherwise confidential information. 
Unauthorized review, forwarding, printing, copying, distributing, or using such 
information is strictly prohibited and may be unlawful. If you are not an 
intended recipient, you are hereby notified that you received this email in 
error, and that any review, dissemination, distribution or copying of this 
email and any attachment is strictly prohibited. If you have received this 
email in error, please contact the sender and delete the message and any 
attachment from your system. Thank you for your cooperation
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to