[Python-Dev] Re: About Pyrex

Greg Ewing greg@cosc.canterbury.ac.nz
Wed, 10 Apr 2002 16:44:42 +1200 (NZST)

> I was wondering if you know about Boost.Python:
>    http://www.python.org/sigs/c++-sig/

I had heard of it, but hadn't looked very closely at it.
It looks interesting -- you seem to be approaching the
problem from exactly the opposite direction, in a way.
It's hard to get an idea of how your approach stacks
up against mine, because they're so different.

One thing I can say is that yours stands a better chance
of coping with C++ in its full generality than mine
does at the moment!

> In your example you cross the boundary (via a C API call) each time
> you produce a result. Isn't that in general eliminating much of the
> gain of using C?

No, because in that example there's a lot of computation
going on between each result. The inner loop there isn't
the one collecting results, it's the one doing the divisions,
which runs entirely in C.

I hope to teach Pyrex more about some of the builtin
objects, so, e.g. you could return an array.array of
numbers instead of a Python list. But even then, if
Python code is to do anything with the individual
numbers, they will get converted to Python objects.

In general -- if Python code needs to get at the results,
they have to be converted to Python objects somewhere,
somehow. I don't see a way around that.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+