Details
-
Suggestion
-
Resolution: Fixed
-
P4: Low
-
6.5.1
-
None
-
-
07c06735e (dev)
Description
I have a need to expose namespace in my code as a python submodule, my C++ code is divided into several namespaces like
namespace Framework::ModA /* ModA stuff */ namespace Framework::ModB /* ModB stuff */
Now I want to recreate such a structure in my python bindings.
import Framework.ModA import Framework.ModB
currently that is not possible cause namespace is exposed as a class, the best that can be done is type alias it like:
ModA = Framework.ModA some_func = Framework.ModA.some_func
however that does not mean the same thing - as functions / variables etc arent 'available' without extra typing or having type alias everything that is inside it.
would be nice to have an option to do so via some extra xml attr?
<namespace-type name="decimal" asSubModule="true"> or somethng like that
pybind11 allows something like this via def_submodule function - heres a link to github
https://github.com/pybind/pybind11/discussions/4027