Submodules in dynamic modules?

Martin Sjögren martin at strakt.com
Thu Jul 26 02:47:32 EDT 2001


Is there a standardized way to use submodules in a dynamic module written
in C? I have a module (foo) that should have a few submodules in it, foo
by itself won't contain much at all, but it's nice to group things up in
submodules, so I could do

from foo import bar

or

from foo import bar, baz

The way I'm doing it right now is that I've more or less copied the source
code from Py_InitModule4() to set things up, and then insert the module
object into the dictionary.

Is there a better way to do this?

Martin

-- 
Martin Sjögren
  martin at strakt.com              ICQ : 41245059
  Phone: +46 (0)31 405242        Cell: +46 (0)739 169191
  GPG key: http://www.strakt.com/~martin/gpg.html




More information about the Python-list mailing list