Skip to content

Conversation

marcmengel
Copy link

The way pybindgen currently works you frequently have to call list(obj.some_method()) when the C++ some_method returns std::vector<> or other container type, to get a fully functional list.

This patch adds an auto_convert parameter to the container that automatically does that for you.
So if you were doing:

mod.add_container('std::vector<std::string>','std::string','vector')

but always doing list(value) for those values, you can instead:

mod.add_container('std::vector<std::string>','std::string','vector',auto_convert="PyList_Type")

and wrapped methods returning that type will always be converted to a list().

Unfortunately this does not happen recursively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant