remove python-specific code from the c++ core

Replace the python object interface by functions returning c++ objects.
Keep the core clean, let swig create python wrappers.