"Mac Ryan" <quasipe...@gmail.com> wrote
While I am working my way up to a more pythonic and cleaner style in
the code, one thing that I have very confused ideas about is how I
should organise my code, in terms of classes and files.
I don't think there is any definitive answer.
- Put reusable components into modules.
- Don't necessarily create a module per class, but rather gather
related classes into a single module.
- Build modules "bottom up" so that depenedencies tend to
go one way, with higher level modules importing lower level ones.
Beyond that there are many different approaches to organisation.
They all have strengths and weaknesses.
The good news is that Python is such a high level language
that you rarely have projects with so many modules that you
need to create sophisticated directory structures. Usually
everything can fit in one project folder. (Zope, Django etc being
good examples of exceptions! :-)
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor