[Pyrex] Low level operations
Robin Becker
robin at reportlab.com
Sun Jun 29 09:47:24 CEST 2003
In article <200306290719.h5T7JMX00491 at oma.cosc.canterbury.ac.nz>, Greg
Ewing <greg at cosc.canterbury.ac.nz> writes
>> It makes large use of double, unsigned short, unsigned byte arrays which
>> are all dynamically allocated.
>>
>> How should I allocate/deallocate memory for these arrays? It seems that
>> Python may not be using the 'standard' malloc/free under some
>> circumstances. Does Python export its low level allocation stuff?
>
>You can allocate memory however you want, as long as you free
>it the corresponding way. For example, you can define an
>extension type that allocates memory using malloc() in its
>__new__ method and frees it using free() in its __dealloc__
>method.
>
>You might also like to investigate using the Numeric module.
>It's possible to write Pyrex code that operates on the contents
>of a Numeric array, and Numeric can take care of the reading
>and writing if you want it to.
.....yes thanks, I see that in the demos. I have a rather large
unstructured set of codes which used to be a complete command line
package for dos machines. It had its own commands eg plot simulate etc
etc. I'm now trying to get the guts out and replace all the glue with
python. The main bit is an interpreter for large sets of econometric
equations. It's intended that this should go into the British Treasury
as a model solver. It will be a bit of a coup for Python if I can do
that. The intention is that the code should be public domain.
--
Robin Becker
More information about the Pyrex
mailing list