On Thu, 2014-05-29 at 08:31 -0400, Rafael Schloming wrote:
> If you're strictly concerned about C <-> Python interop and not concerned
> with providing bindings in other languages, there are a number of other
> tools that could help (cffi, ctypes, and Cython). This page lists them and
> talks about some of their pros and cons:
> https://packaging.python.org/en/latest/extensions.html
> 

Thanks! How about tools that go the other way: C calling python? Doing
things by hand with the basic Python.h primitives is pretty verbose and
error prone: are there any tools that will generate safer/easier to use
C APIs for specific python classes?

> On Wed, May 28, 2014 at 9:09 AM, Darryl L. Pierce <[email protected]>
> wrote:
> 
> > On Fri, May 23, 2014 at 08:06:44AM -0400, Alan Conway wrote:
> > > What's the general feeling about using SWIG in dispatch? To date
> > > dispatch uses hand-crafted calls based on Python.h primitives. My
> > > impression is that works OK for a small python/C interface but the
> > > interface is getting to the point where SWIG may be helpful.
> > >
> > > Opinions anyone? Objections?
> >
> > Hrm, I'm not sure it would be the right way to go. Swig is great for
> > taking a library and present it as a dynamic module for languages like
> > Python, Perl and Ruby. But for what Dispatch is doing, we're already
> > using the Python development code that provides C <-> Python interfaces;
> > i.e., we're already doing what Swig would be asked to do for us in the
> > codebase. Unless we're going to have Dispatch be a totally Python
> > application that depends on a library of functions written in C,
> > shouldn't we keep things the way they are now and leverage that level of
> > control?

My concern is that as the boundary of interaction grows it will become
complicated and error-prone to maintain hand-written wrappers. E.g. look
at router_pynode.c. It's a lot of hand-written call-Python-from-C code
to generate a python class view of a C API. I suspect that a thin swig
wrapper between clean Python code and a clean C API would be easier to
understand and maintain thank this C/Python mish-mash. (I might be
wrong, if I am I won't do it :)

I'm not rushing to change things yet, just getting the lie of the land.

Cheers,
Alan.




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to