[PyKDE] SIP vs Boost.Python?
Niac Neb
niacneb at yahoo.com
Tue May 17 00:51:33 BST 2005
James,
Where might I find a complete example of this? Is
there a WIKI or site where developers have posted
their examples?
Thanks for the reply. My interest in SIP has
increased. Seems it might be easier to code to than
Boost.Python. However, I've not found examples.
--- James Emerton <ephelon at gmail.com> wrote:
> Here's the most maintainable way of calling Python
> from C++. This
> method keeps your C++ out of your Python and your
> Python out of your
> C++. As a bonus feature, if the Python
> implementation gets too slow,
> you can rewrite in C++ without needing to touch any
> client code.
>
> //
> // iface.h
> struct IFoo {
> virtual float wonk(float, float) = 0;
> };
>
> //
> // iface.sip
> %Module foo
> class IFoo {
> %TypeHeaderCode
> #include "iface.h"
> %End
>
> public:
> virtual float wonk(float, float) = 0;
> };
>
> //
> // impl.py
> from foo import IFoo
>
> class FooImpl( IFoo ):
> def wonk( self, n1, n2 ):
> return n1 * n2
>
>
> The only thing left to do in instantiate FooImpl and
> hand it back to
> some C++ function.
>
> James
>
__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail
More information about the PyQt
mailing list