Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66616 > unrolled thread
| Started by | Nagy László Zsolt <gandalf@shopzeus.com> |
|---|---|
| First post | 2014-02-17 19:14 +0100 |
| Last post | 2014-02-17 19:14 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Import order question Nagy László Zsolt <gandalf@shopzeus.com> - 2014-02-17 19:14 +0100
| From | Nagy László Zsolt <gandalf@shopzeus.com> |
|---|---|
| Date | 2014-02-17 19:14 +0100 |
| Subject | Re: Import order question |
| Message-ID | <mailman.7106.1392660896.18130.python-list@python.org> |
>> 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. 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 do. > >> 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>. This is funny, because I was working for wxPython for years and this article is making an example with wxPython. It is one of the best toolkits around. Some years ago I wondered why did they not follow PEP8 and used lower case method names. Then I found out that these are C++ wrapper classes, many of them automatically generated from C++ code. So that is why. But by that time I was using captialized method names for UI widgets everywhere, and I guess this is my bad habit now. Probably when it comes to UI widgets I do not think the Pythonic way for the same reason. 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. Thanks for the help.
Back to top | Article view | comp.lang.python
csiph-web