Nagy László Zsolt <gand...@shopzeus.com> writes: > I have a class hierarchy like this: > > Widget <- VisualWidget <- BsWidget > > and then BsWidget has many descendants: Desktop, Row, Column, Navbar > etc.
None of this implies anything about which modules you place these in; Python is not Java, and you should be putting your class definitions wherever makes the most sense for reading and access. > Here is the problem: these methods should create instances of Row, > Column and Navbar. But this leads to circular imports. It should not; Python is not Java. Use modules to group your class definitions conceptually. There is no need whatever to separate every class into a different module. > * I want to put different widget classes into their corresponding > different source files Please, don't. > This might be a bad idea, but then please tell me why it is bad, and > what would be the right code pattern for this task. Not only does it lead to the problem you've described, it makes the code needlessly difficult to read. Pyth is not Java <URL:http://dirtsimple.org/2004/12/python-is-not-java.html>. -- \ “I do not believe in forgiveness as it is preached by the | `\ church. We do not need the forgiveness of God, but of each | _o__) other and of ourselves.” —Robert G. Ingersoll | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list