Python objects in C++

Sometime I find myself thinking in Python. Or, accurately, wistfully thinking of Python. Raw C++ is completely hamstrung when it comes to simple concepts like handling strings or dealing with lists (maybe BOOST is better?). Why can’t I just do this:

remaining_args = sys.argv[3:7]

I don’t even mind if it looks like this:

PyList argv = new PyList( argv, argc );
PyList remaining_args = argv.slice( 3, 7 );

Is this kind of thing possible? If not, someone really should package up the Python library in such a way that it is.

Of course, I’m speaking from a position of total ignorance here: maybe someone has done what I’m talking about with the Python stuff. After a brief look at BOOST, I can say for sure that it continues the STL’s tactic of “under-use through obscurity” and “surprisingly missing all the useful features”. No slice operator, anyway…

If they have done/do do the Python thing, the most frustrating part then is going to be wishing you could have all the bits of the Python library that are written in Python. Does anyone fancy starting the “GCP” project?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.