Thanks for your feedback, Francois.
When the C++ code returns by const
reference, it might be OK for the Python wrapper to return by value. But when the C++ code returns by non-const reference, I find it counter-intuitive for the Python wrapper to return by value. It would introduce an inconsistency between Python user code and the equivalent C++ user code.
The decision whether or not the Python wrapper should return by value might also depend on the size of the object.
Clearly this is a recurring problem, but I think there is no silver bullet.