aoloe / cpp-pybind11-playground

Creating a Scripting Egnine with pybind11. Step by step. https://github.com/pybind/pybind11
36 stars 9 forks source link

Fix eval-file-pyqt5-set-value #6

Closed galou closed 4 years ago

aoloe commented 4 years ago

thanks for the fixes!

aoloe commented 4 years ago

sorry, the _ was needed. i've re-added it in the next commit.

galou commented 4 years ago

Yes, I added the _ because locals is a reserved word. By the way, how is it possible thatset_the_answeris available inmainbut not inget_the_value`? Thanks

aoloe commented 4 years ago

yeah, i've seen it later.
i've now renamed it to outer_locals.

the reason why the injected function is not available inside of the other function, is related to the way pybind11 runs the python code.
i don't have a deep knowledge about it, but i've been told that it's called as if it's inside of a class.

some notes about it are in the README file in the same directory : - )