Q: organizing classes in modules
Toby Dickenson
mbel44 at dial.pipex.net
Wed Mar 22 04:54:40 EST 2000
Stephan Reiling <sreiling at elara.tripos.com> wrote:
>I have a question about how to organize classes in modules:
>I would like to organize my classes so that every class has its own file, the
>file having the same name as the class, e.g.
>In file Class1.py
> class Class1:
> ...
>
>I would also like to put these into a module, for example module1. When I now
>want to use Class1, I would like to just say:
>
>import module1
>c=module1.Class1()
>
>instead I have to say:
>
>import module1
>c=module1.Class1.Class1()
I find that style hard to read because the duplicated words are so
close together. I prefer to visually break it up....
from module1.Class1 import Class1
c=Class1()
Toby Dickenson
tdickenson at geminidataloggers.com
More information about the Python-list
mailing list