Re: python classes/file structure

2005-04-22 Thread Terry Hancock
On Thursday 21 April 2005 08:48 am, codecraig wrote: > widget = gui.MyCustomWidget.MyCustomWidge() > > ...seems weird, how should I structure this? Is it not common to have > one class in a .py? No, it isn't really. Usually, there will be several related classes in a single module. Only if the

Re: python classes/file structure

2005-04-21 Thread Steve Holden
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 CustomWidg

Re: python classes/file structure

2005-04-21 Thread Steve Holden
codecraig wrote: Thanks, but I am not familiar with the "__all__" variable, could u give me an example? Without using, __all__would i do this in my __init__.py? import MyCustomWidget1 import MyCustomWidget2 import MyCustomWidget3 etc? Yes, correct. __all__ just limits the names that are importe

Re: python classes/file structure

2005-04-21 Thread codecraig
also is it common to have one class per file? seems weird to have, MyCustomWidget.MyCustomWidget thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: python classes/file structure

2005-04-21 Thread codecraig
Thanks, but I am not familiar with the "__all__" variable, could u give me an example? Without using, __all__would i do this in my __init__.py? import MyCustomWidget1 import MyCustomWidget2 import MyCustomWidget3 etc? -- http://mail.python.org/mailman/listinfo/python-list

Re: python classes/file structure

2005-04-21 Thread Steve Holden
codecraig wrote: What is the best/common way to structure ur python code for an application? For example...if I create some custom GUI widgets I have this C:\stuff --> gui --: MyCustomWidget.py --: TestWidgets.py so MyCustomWidget.py has one class, class MyCustomWidget: ... so from

python classes/file structure

2005-04-21 Thread codecraig
What is the best/common way to structure ur python code for an application? For example...if I create some custom GUI widgets I have this C:\stuff --> gui --: MyCustomWidget.py --: TestWidgets.py so MyCustomWidget.py has one class, class MyCustomWidget: ... so from TestWidgets.p