C Extension and multiple namespaces

Peter Kropf pkropf at legato.com
Tue Sep 23 19:28:59 CEST 2003

I'm looking for a way to create multiple namespaces / dictionaries from
within a Python C extension. I'd like to replicate something like:


Where a\__init__.py import b and b\__init__.py imports c.

Python 2.2.3 (#1, Jul  9 2003, 16:15:35) 
[GCC 3.2] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import a
>>> dir(a)
['__builtins__', '__doc__', '__file__', '__name__', '__path__', 'b']
>>> dir(a.b)
['__builtins__', '__doc__', '__file__', '__name__', '__path__', 'c']
>>> dir(a.b.c)
['__builtins__', '__doc__', '__file__', '__name__', '__path__']

I haven't been able to find any examples or other extension modules that do
anything like this, so it might not even be possible. But any help or
pointers would be appreciated.


- Peter

Special Projects Group, Legato Systems
3210 Porter Drive, Palo Alto, CA 94304
650-812-6081 Desk
408-482-9427 Cell
pkropf at legato.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030923/d1eded5c/attachment.html>

More information about the Python-list mailing list