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


Groups > comp.lang.python > #66644

Re: Import order question

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'package,': 0.03; 'tries': 0.07; 'function,': 0.09; 'useless': 0.09; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'exceptions,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'namespace.': 0.16; 's/he': 0.16; 'taming': 0.16; 'utterly': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; 'feb': 0.22; 'import': 0.22; 'otherwise,': 0.22; 'putting': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; '(by': 0.24; 'mind.': 0.24; 'module,': 0.24; 'package.': 0.24; 'scroll': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'class.': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'easier': 0.31; 'that.': 0.31; 'origin': 0.31; 'such.': 0.31; 'class': 0.32; 'not.': 0.33; 'there,': 0.34; 'maybe': 0.34; 'could': 0.34; 'johnson': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'module.': 0.36; 'method': 0.36; 'useful': 0.36; 'should': 0.36; 'easily': 0.37; 'files': 0.38; 'even': 0.60; 'eventually': 0.60; "you're": 0.61; 'first': 0.61; 'us,': 0.73; "it'd": 0.84; 'absolutely': 0.87; 'to:none': 0.92; 'rick': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=hyMR5rN7zDl6lSSHSoP1IjWTlNiW1w/vDA/QG1RVd5I=; b=Z1sVdTCas6/D/Uv8pSgbEw8TCWEuUbakDGoxXjg3rMbaWNXV7ioHkAbLxgNo/eYCBn gJjORnF8cQY40GCpCQNyz5MZh1BWzB9BS+b+fwOkU8wbSZNDFGoljTW0gz2oB6581FU8 DNmQHZROrzc7TMkxSM2oXMBNv+iM2tYj/pTJjtg5eg4oFKsR5WCFhD+umkEg50Vj8Q0Q N+nmap/jMR0dJ56qVzoZjVMi5mY6gVqPGSaP88BlUmCamIgsQQTmR7UxeFXmUQVLt3/G 4E4lwEqQtJhQ29aCpYh1kEfWQOfGaCPQD0QXb2kLoBMjmF+SIwPRDqtnZu/JlJxSox4l CUaA==
MIME-Version 1.0
X-Received by 10.66.160.2 with SMTP id xg2mr35090220pab.23.1392757346357; Tue, 18 Feb 2014 13:02:26 -0800 (PST)
In-Reply-To <c25d98d8-ed6b-492a-85e7-4a241589f2ef@googlegroups.com>
References <53020843.5010804@shopzeus.com> <851tz16fzt.fsf@benfinney.id.au> <53025198.1060000@shopzeus.com> <mailman.7110.1392666057.18130.python-list@python.org> <c25d98d8-ed6b-492a-85e7-4a241589f2ef@googlegroups.com>
Date Wed, 19 Feb 2014 08:02:26 +1100
Subject Re: Import order question
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.7124.1392757348.18130.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1392757348 news.xs4all.nl 2844 [2001:888:2000:d::a6]:37446
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:66644

Show key headers only | View raw


On Wed, Feb 19, 2014 at 7:41 AM, Rick Johnson
<rantingrickjohnson@gmail.com> wrote:
>     # ui_main.py
>     from ui_mod1 import *
>     from ui_mod2 import *
>     from ui_mod3 import *
>     from ui_mod4 import *
>
> At least by this method i can maintain the code base without
> wearing-out my scroll finger and eventually loosing my mind.
> THE MORAL: With very few exceptions, please put EVERY class
> in it's own module.

Absolutely definitely not. If you're going to import * into every
module, just write it all in a single source file. Otherwise, when
someone tries to find the source code for some particular class or
function, s/he has to go digging through all five source files - first
the utterly useless merge-point, then the four others, because there's
no way to know which one has it.

Python could make this easier for us, by retaining the origin of every
function and class. And maybe it's already there, but I don't know
about it. But even if it did exist (by the way, it would be useful for
other things than just taming a mad layout like this), it'd still be
better to keep everything combined, because the origin of a
function/class could just as easily go to the exact line as to the
file.

A module is a namespace. It should be used as such. If you want a
package, use a package. There's no point putting each class out
separate unless you really need that.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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