Import order question
ben+python at benfinney.id.au
Mon Feb 17 20:40:41 CET 2014
Nagy László Zsolt <gandalf at shopzeus.com> writes:
> > Use modules to group your class definitions conceptually. There is
> > no need whatever to separate every class into a different module.
> If there is a consensus, and it is really desireable to put all these
> related classes into the same module, then this is what I'm going to
You should use multiple modules to separate the code where it makes
sense, along *conceptual* lines. Make separate modules that each
represent a conceptually-separate area of functionality in your
application, and put the classes which implement that functionality in
> I never know when to put classes in different modules. I usually draw
> an UML diagram and group classes into packages. Wich makes sense
> because there can be sub-groups with subpackages. But I'm always
> confused with modules, I don't know why.
You can start by making one module for each of those groupings. (The
term “package” already has a specific technical meaning in Python, and
I'm not sure whether that's what you meant here.)
> Thanks for the help.
Welcome to Python!
\ “If sharing a thing in no way diminishes it, it is not rightly |
`\ owned if it is not shared.” —Augustine of Hippo |
More information about the Python-list