structuring a package?

Torsten Mohr tmohr at
Mon Jan 5 01:17:57 CET 2009


i have a question on how to structure a package best, would be great if
anybody could give me some hint on this:

Assuming i have a base class GraphicObject and derived from that some
classes like Square, Circle, ...

It looks natural to me to write in a code that uses the package:

import graphic
import graphic.square

That way i'd have to structure the code like this:

  __init__,py  (GraphicObject) (Square) (Circle)

Does that make sense like this?

Are there better ways to structure things in Python?

One thing that bothers me is that when i write in something like
"import graphic", then i can't have the test code for the Circle within, at least it looks to me like this.

The closest thing that handles this issue that i could find was PEP 328, but
it doesn't cover this problem.

Thanks for any hints,

More information about the Python-list mailing list