Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #66623

Re: Import order question

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 <python-python-list@m.gmane.org>
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 <ben+python@benfinney.id.au>
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 <bignose+hates-spam@benfinney.id.au>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.7110.1392666057.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


Nagy László Zsolt <gandalf@shopzeus.com> 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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Import order question Ben Finney <ben+python@benfinney.id.au> - 2014-02-18 06:40 +1100
  Re: Import order question Rick Johnson <rantingrickjohnson@gmail.com> - 2014-02-18 12:41 -0800
    Re: Import order question Chris Angelico <rosuav@gmail.com> - 2014-02-19 08:02 +1100
      Re: Import order question Rick Johnson <rantingrickjohnson@gmail.com> - 2014-02-18 13:44 -0800
        Re: Import order question Chris Angelico <rosuav@gmail.com> - 2014-02-19 08:49 +1100
          Re: Import order question Grant Edwards <invalid@invalid.invalid> - 2014-02-18 22:44 +0000
        Re: Import order question Tim Chase <python.list@tim.thechases.com> - 2014-02-18 16:17 -0600
          Re: Import order question Grant Edwards <invalid@invalid.invalid> - 2014-02-18 22:45 +0000
          Re: Import order question Rick Johnson <rantingrickjohnson@gmail.com> - 2014-02-18 14:49 -0800
        Re: Import order question Rotwang <sg552@hotmail.co.uk> - 2014-02-18 23:28 +0000
          Re: Import order question Rick Johnson <rantingrickjohnson@gmail.com> - 2014-02-18 15:41 -0800
            Re: Import order question Rotwang <sg552@hotmail.co.uk> - 2014-02-19 01:09 +0000
            Re: Import order question Steven D'Aprano <steve@pearwood.info> - 2014-02-19 07:32 +0000
          Re: Import order question MRAB <python@mrabarnett.plus.com> - 2014-02-19 00:18 +0000
        Re: Import order question Chris Angelico <rosuav@gmail.com> - 2014-02-19 12:57 +1100
        Re: Import order question Steven D'Aprano <steve@pearwood.info> - 2014-02-19 07:32 +0000
          Re: Import order question Chris Angelico <rosuav@gmail.com> - 2014-02-19 18:59 +1100
          Re: Import order question Roy Smith <roy@panix.com> - 2014-02-19 08:28 -0500

csiph-web