module level subclassing
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Dec 11 05:59:56 EST 2007
En Mon, 10 Dec 2007 16:43:15 -0300, km <srikrishnamohan at gmail.com>
escribió:
> Is there a way to access the classes defined in the __init__.py into the
> modules files in the directory?
> for example say i have a module (dir) M with contents __init__.py and
> a.pyand
> b.py
> a.py and b.py would like to subclass/instantiate a class defined in
> __init__.py
> how's that possible ?
Move the relevant parts of __init__.py into c.py, and make a.py and b.py
import c.
You can import the class into __init__.py too, if you want to maintain the
package's external interfase the same.
--
Gabriel Genellina
More information about the Python-list
mailing list