python classes/file structure

Steve Holden steve at holdenweb.com
Thu Apr 21 14:16:07 EDT 2005


codecraig wrote:
> also is it common to have one class per file?
> 
> seems weird to have, MyCustomWidget.MyCustomWidget
> 
> thanks
> 
Well, this *is* fairly normal, but you can manage the namespace to your 
advantage if you wish. So, for example, gui/__init__.py could do

     from CustomWidget import CustomWidget

and then

     from gui import *

sees CustomWidget.CustomWidget simply as CustomWidget.

regards
  Steve
-- 
Steve Holden        +1 703 861 4237  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/




More information about the Python-list mailing list