On Oct 9, 4:56 pm, Stefan Arentz <[EMAIL PROTECTED]> wrote: > Is it possible to mix classes defined in both Python and C in the same > module? Ideally I would like to be able to do: > > from some.module import MyPythonClass, MyCClass > > I guess that would mean that this would look like this on disk: > > some/ > __init__.py > module.py (contains MyPythonClass) > module.so (contains MyCClass) > > But would this work? > > S.
Yes, but you need to write your own importer and customize it using ihooks.py. The builtin imp module also contains a function new_module that lets you allow creating a module without any file reference. This can be returned containg the names of both module.py and module.so. -- http://mail.python.org/mailman/listinfo/python-list