Yes, that sounds like a good way to handle std::optional<T>
. The Python user would only ever see a T
or None
, because the wrappers would automatically do the has_value()
check for the benefit of the user.
I’m in agreement with Ben regarding T*
. Returned pointers are horridly ambiguous from C++, and can only be handled nicely in Python via an abundance of hints.