Bind C++ program for use with both Python 2.x and 3.x

Martin v. Loewis martin at v.loewis.de
Sat Dec 11 18:03:31 EST 2010


Am 11.12.2010 23:41, schrieb Peter C.:
> Hello, I am looking at the possibility of making a program in C++. The
> catch is it will require the ability to work with binding for use with
> scripting in both Python 2.x and 3.x for various tool plugins. Is
> there any way to bind a C++ app to work with both Python 2.x and 3.x
> using the Python C API? Note if I could I'd just do Python 3, however
> I need Python 2 support to allow for the use of this application as a
> plugin in apps that use Python 2 as well.

Notice that binding to Python 2 may not be enough: you also need to
specify the Python 2 version (i.e. different bindings for 2.5, 2.6, and
2.7, say). You will have to ship different copies of the binding. Of
course, you can ship them in a single distribution (zip file, or
whatever your distribution format is).

If you are creating different copies of the binding, supporting both
2.x and 3.x simultaneously will be straight-forward.

Regards,
Martin




More information about the Python-list mailing list