[Pyrex] referencing the module object (__pyx_m aka module_cname)?

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Nov 8 02:26:51 CET 2004


Yann Vernier wrote:
> On Sun, Nov 07, 2004 at 01:53:31PM -0500, Phillip J. Eby wrote:
 >
>>cdef public object Text_Init():
>>    ...
>>    import Blender.Text as retval
>>    return retval
> 
> But Text_Init needs to return the object to be put in Blender by the
> name Text, so this is recursive. 

There's nothing recursive about a Pyrex module importing
itself. By the time any user-written initialisation code
gets run, the module object has already been created and
added to sys.modules, so it can be imported.

But perhaps I don't correctly understand what you're
trying to do. It sounded like you were re-implementing
an existing extension module in Pyrex. If that's not the
case, you'll have to elaborate.


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




More information about the Pyrex mailing list