Extending Python: rewriting a single method in C
Alex Martelli
aleaxit at yahoo.com
Mon Mar 12 06:52:56 EST 2001
"Jacek Generowicz" <jmg at ecs.soton.ac.uk> wrote in message
news:g0wv9vxms0.fsf at scumbag.ecs.soton.ac.uk...
> I have an object-oriented numerical code written in Python. It has
> come to the stage where the speed of the code is seriously impeding
> progress. Profiling reveals (surprise, surprise) that most of the time
> is spent in only 2 methods.
>
> Is there any way of re-writing just these methods in C ?
You can write a function (in C) that takes the needed state
information as arguments, and your Python-level method will
delegate everything to that function.
Doing it with a "real" method would need C++ (and, e.g.,
Boost Python).
Alex
More information about the Python-list
mailing list