dissecting a python dictionary #5264
AllinCottrell
started this conversation in
General
Replies: 1 comment
-
OK, I think I've got the idea now:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My C code wants an array of key:value pairs from the user, and the natural interface on the python side would seem to be a dictionary. The values must be of type string, int or float, each type needing specific handling. So in pybind11 I need to iterate over the dictionary checking the values. Here's my first attempt at "proof of concept" code:
This code fails to compile at the first hurdle, with the message
error: ‘class pybind11::dict’ has no member named ‘keys’
so clearly I've got the wrong idea. What is the right idea, please?
Beta Was this translation helpful? Give feedback.
All reactions