Best practice in organize classes into modules

Steven Woody narkewoody at gmail.com
Fri Jan 9 09:59:26 CET 2009


On Fri, Jan 9, 2009 at 4:54 PM, Bruno Desthuilliers
<bruno.42.desthuilliers at websiteburo.invalid> wrote:
> Steven Woody a écrit :
>>
>> On Fri, Jan 9, 2009 at 1:02 PM, James Mills
>> <prologic at shortcircuit.net.au> wrote:
>>>
>>> On Fri, Jan 9, 2009 at 2:57 PM, Steven Woody <narkewoody at gmail.com>
>>> wrote:
>>>>
>>>> In C++/Java, people usually put one class into one file.  What's the
>>>> suggestion on this topic in Python?  I so much interesting this
>>>> especially when exception classes also involved.
>>>
>>> Normally i group related functionality into the one module.
>>
>> Will that lead to too large source file size?
>
> When the case happens, then you can safely refactor the module into a
> package with submodules, and use the package's __init__.py to make it a
> facade for the submodules so the refactoring is transparent for client code.

really a smart idea.  Did you mean putting some 'import statement in
__init__.py and use the old module name as the new package name?
Thanks.



More information about the Python-list mailing list