[Tutor] int to bytes and the other way around

Stefan Behnel stefan_ml at behnel.de
Tue Jul 7 07:48:43 CEST 2009


Chris Fuller wrote:
> The only things that matter are the arguments and the result.  It sounds to me 
> like a good case use for SWIG (http:://www.swig.org).  You can do really 
> complicated stuff with swig, and it takes a correspondingly steep learning 
> curve to achieve, but doing simple stuff is really simple.  It sounds like 
> the first example in the SWIG docs could be straightforwardly adapted to your 
> problem.

I think the OP was already talking about a ctypes based solution. If that's
all the OP needs, that's just fine, and will work out-of-the-box without
depending on things like a C++ compiler.

Regarding SWIG, you are definitely right about the "steep learning curve"
and the "complicated stuff". If you want to just get your work done, it's
usually better to go with Cython directly, instead of trying hard to make
SWIG do what you want. Because once you get to the "complicated stuff", you
will (hopefully) take the shortcut of rewriting your code in Cython anyway.

Stefan



More information about the Tutor mailing list