[Pyrex] Can pyrex codes call python objects/methods such as String, re, datetime, os diretively

Lenard Lindstrom len-l at telus.net
Mon Jul 2 04:37:42 UTC 2007


liangxing wrote:
> As I have found out, a function can be defined as Python-func or C-func. With Python-functions, the return value and parameters can be regarded as a general python object. It is true.
>
> But I still hava one puzzle in "interfacing with a existing python object". Could I take such mearsures in order to utilizes Python built-in Method as follows:
>
> ---------myprex_prog.pyx---------
> import sys
> import datetime
> import cx_Oracle
> include "Python.h"
> .....
>
> print sys.path
> ...
> datatime.datetime.now()
> ....
> conn = cx_Oracle.connection()
> ...
> -----------------------------------------
>
> My case is retrieveling all record items from a Oracle Database, within a loop execution. By calling cursor.fetchmany() multi-times, I found it is quite slow. I am planing to reimplement this program in Pyrex.
> But I wonder is it possible to have a python object/method called in Pyrex program.
> ths in advance, buddy.
>
>   

Any Python function or method can be called in Pyrex. If you hope to 
make your Python module faster by compiling it as a Pyrex module then 
you may be disappointed. Pyrex modules only become noticeably faster 
when C variables and functions are used.

-- 
Lenard Lindstrom
<len-l at telus.net>




More information about the Pyrex mailing list