Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'definitions': 0.07; 'lines.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:question': 0.10; 'finney': 0.16; 'modules,': 0.16; 'modules.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sense,': 0.16; 'do.': 0.18; 'module': 0.19; 'packages.': 0.19; 'meant': 0.20; 'help.': 0.21; '(the': 0.22; 'separate': 0.22; 'header:User-Agent:1': 0.23; 'module,': 0.24; 'why.': 0.24; 'header:X-Complaints-To:1': 0.27; 'related': 0.29; 'along': 0.30; "i'm": 0.30; 'code': 0.31; 'usually': 0.31; 'writes:': 0.31; 'class': 0.32; 'sense': 0.34; 'classes': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'module.': 0.36; 'received:com.au': 0.36; 'thanks': 0.36; 'should': 0.36; 'area': 0.37; 'implement': 0.38; 'represent': 0.38; 'ben': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'making': 0.63; 'term': 0.63; 'different': 0.65; 'skip:\xe2 10': 0.65; 'sharing': 0.69; '8bit%:46': 0.78; 'nagy': 0.84; 'received:125': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Import order question Date: Tue, 18 Feb 2014 06:40:41 +1100 References: <53020843.5010804@shopzeus.com> <851tz16fzt.fsf@benfinney.id.au> <53025198.1060000@shopzeus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: vmx15867.hosting24.com.au X-Public-Key-ID: 0xBD41714B X-Public-Key-Fingerprint: 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-gpg.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:IhH+4xzhTD3g3RJhJgb4ZOzV7VE= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392666057 news.xs4all.nl 2944 [2001:888:2000:d::a6]:43722 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66623 Nagy László Zsolt 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 > do. 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 that module. > 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 | _o__) | Ben Finney