python namespace

Francois Ostiguy ostiguy at fnal.gov
Thu Nov 21 11:36:13 EST 2002


Hello All -

I am trying to understand how to achieve the following.

Assume 2 functions f1 and f2 defined in a C shared library named
"outer.so".

I would like these functions to be mapped in different namespaces in
python, e.g.

outer.inner1.f1()
outer.inner2.f2()

As far as I understand, this can be achieved by creating the three
modules "outer", "inner1" and "inner2". inner1 and inner2 should be
submodules of outer and f1, f2 defined in inner1 and inner2 respectively.

Can this be done *without* creating a directory structure and three
separate modules ? In other words, can the outer module
initialization function call PyModule_New to create submodules ?

A simple working example or pointers to relevant documentation
would be much appreciated.

-Francois

----------------------------------------------------------------------------
Dr. Jean-Francois OSTIGUY                              voice: (630) 840-2231
Beam Physics Dept MS220                                  FAX: (630) 840-6039
Fermi National Accelerator Laboratory                email: ostiguy at fnal.gov
Batavia IL 60510-0500                           WWW:www-ap.fnal.gov/~ostiguy






More information about the Python-list mailing list