[Pyrex] Passing C attribs between extension objects

David McNab david at rebirthing.co.nz
Fri Sep 14 10:08:27 CEST 2007


On Fri, 2007-09-14 at 16:38 +1200, Greg Ewing wrote:
> I don't see how that helps speed-wise, because to
> access such an integer from Python, an int object
> needs to be created for it, which is likely to be
> about as expensive as creating a PyCObject.

Good thought - thanks - I'll try this in future versions.

> You might be able to gain something by keeping a
> cache of spare PyCObjects, like Python does with
> ints (I think).

Ditto.

>  > there are low level C API calls that
> > require attributes of 2 or more different extension objects.
> 
> Not knowing the details of your API it's hard to
> say, but I suspect you would be better off re-thinking
> the problem from another angle. For instance, providing
> functions that take the extension types directly and
> extract the relevant values from them, rather than
> leaving this to the calling Python code.

I'll look into this - again, thanks for your helpful comments.

Cheers
David






More information about the Pyrex mailing list