Improve C++ and python syntax