Mutual module imports

George Sakkis gsakkis at
Tue Oct 18 06:49:35 CEST 2005

"Tony Nelson" <*firstname*nlsnews at georgea*lastname*.com> wrote:

> [snipped]
> I have written a Python module that uses some C functions.  I wrote the
> module in two parts, one Python, one Pyrex (C).  They need to share some
> globals.

> [snipped]
> Now the Python module imports the Pyrex module and just shoves
> references to its globals into the Pyrex module (the Pyrex module
> defines them as None).  The Pyrex module doesn't import the Python
> module anymore.  This also works, even when the Python module has a
> different name (e.g. "__main__").  I just feel dirty about it.

Well, I feel dirty every time I have to share globals <wink>.


More information about the Python-list mailing list