module naming?

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Apr 18 03:41:44 CEST 2000


"Michal Wallace (sabren)" wrote:
> 
> def Record(dbc, table):
>    import zdc.record, zdc
>    zdc.Record = zdc.record.Record
>    return zdc.record.Record(dbc, table)
> 
> Is there a better way to do this?

Yes. In your __init__.py, simply say

   from Record import Record

That will put the Record class in the zdc package
namespace. 

The only drawback is that all the submodules will
be loaded as soon as zdc is imported, even if they're
not all used.

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-list mailing list