I've been looking at pybindgen and have a simple question -- why do the container wrappers not implement more of the python container interface? For instance, you can expose the std::vector<int> like so:

vecint = mod.add_container("std::vector<int>", "int", "vector", custom_name="vector_of_int")

The resulting type won't let you take the length with "len" or index into the instances with []. I would naively think maybe I could add these methods as appropriate to types using "add_method" like the following:

vecint.add_method("size", "int", [], custom_name = "__len__")

but because "Container" does not inherit from "CppClass" I don't see how to easily extend the container in this manner. Is there a deep reason these things are this way?

Thanks!

Mike.


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

Reply via email to