[Pythonmac-SIG] SetSystemUIMode in python?

Kent Quirk kquirk at solidworks.com
Sat May 28 04:22:22 CEST 2005


Bob wrote:
>* SWIG (ughh)
>* Write C++ and use Boost.Python (ugh)
>* Python C API directly (not really *that* bad)

Well, I've looked at all of these, and I've gotta disagree with the Ugh
on Boost.Python. At least for large projects. If (like me) you have
large quantities of existing C++ to deal with, Boost.Python is actually
really nice. 

You can build Python classes that inherit from C++ classes, you can
built C++ classes that inherit from Python classes. You can write free
functions, you can construct enums, and you basically use it by writing
down some simple definitions. Your C++ code is idiomatic AND your Python
code is idiomatic. 

Example: using Boost.Python, we constructed an Event (publish/subscribe)
system that allows for arbitrary data to be passed as Python
dictionaries. Events, queues and listeners can be constructed on either
side of the fence and interoperate cleanly. You can have an arbitrary
number of event queues. It's a remarkably easy and clean way to pass
messages around between a collection of otherwise-disconnected
components, and lets us keep static coupling to a minimum.

Boost.Python isn't for everyone, but in our system it was a lifesaver.

	Kent



More information about the Pythonmac-SIG mailing list