naive packaging question
Carl Banks
pavlovevidence at gmail.com
Wed Mar 26 14:04:14 EDT 2008
On Mar 26, 12:33 pm, Scott Sharkey <sshar... at linuxunlimited.com>
wrote:
> Here's the directory structure that I've got so far:
>
> project <dir> top level directory
> setup.py
> company <dir> eventually, we'll have other modules
> __init__.py
> error.py some classes that will be used in all
> log.py modules
> acctdb <dir> the acct db interface directory
> __init__.py
> api.py the abstract class def (derived from object)
> specific.py the specific implementation, derived
> from the api base class
>
> For arguments sake, let's call the base class (defined in api.py)
> 'BaseClass', and the specific implementation 'SpecificClass(BaseClass)'
>
> So, in the acctdb/__init__.py, do I do something like this:
>
> if SPECIFIC_CLASS:
> from company.acctdb.specific import SpecificClass as BaseClass
Seems pretty reasonable to me. Do you have any specific reasons for
being concerned about this organization?
(My only minor suggestion would be not to import the SpecificClass as
BaseClass, but instead with a name that's different from both, for
example, PublicClass. All that does is to avoid a tiny bit of
potential confusion down the road.)
Carl Banks
More information about the Python-list
mailing list