Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81927
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; "subject:' ": 0.07; 'os.path': 0.09; 'subject:modules': 0.09; 'subject:question': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7': 0.14; 'mostly': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imo,': 0.16; 'imports': 0.16; 'modules.': 0.16; 'wrote:': 0.18; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'script': 0.25; 'skip:" 20': 0.27; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'specifically': 0.29; 'external': 0.29; 'am,': 0.29; 'dec': 0.30; 'relative': 0.30; 'especially': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'option': 0.32; 'fri,': 0.33; 'reader': 0.33; 'actual': 0.34; 'sense': 0.34; 'subject:from': 0.34; 'etc': 0.35; 'but': 0.35; 'received:google.com': 0.35; "didn't": 0.36; 'project': 0.37; 'question,': 0.38; 'rather': 0.38; 'is.': 0.60; 'great': 0.65; 'stated': 0.69; 'to:none': 0.92 |
| 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=+2xkjBqHDlX8G11bJuuxslMLOKO0nA6LgiNO0XOUKro=; b=iRwV9E7cj7B/ZIoe3cWuReuRjWHm6Qz5T1SvSTl8EaBR2GUI4Pf18jZ3aSHfaVMp9S XQ1kwTnIP/jnV9ndnaMb7dd7KleWhiIQHSUi8xBY+vafOKctVlS5O6Un0NcoU8zU82OC iN/5KQOZ1ETc/I+8fNfSCPeVxE4T+r6lQ24iebJByTGerDJhwn8zIirV3GiMLO9LlKqU zy9sScyNj0RFmUroRKZNB5/ydv61Mj+hD8udywiOM+ZXs0Rd+OKhv+EZ2NgraZY/FAkC WDpKGqLXzjFmSeDWjOlBHr6X9v8BvtjT+qkZ/jpFJTssc8QAiSKi4MWuEcLl2mv05BBP XBEA== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.62.104 with SMTP id x8mr57322092igr.2.1417716325789; Thu, 04 Dec 2014 10:05:25 -0800 (PST) |
| In-Reply-To | <2047880662.4611734.1417714597653.JavaMail.root@sequans.com> |
| References | <CAPTjJmo1-QCgcbsjKNgH3oN-nm5qjB5GrvCiC6Qc9p+S8cNjpg@mail.gmail.com> <2047880662.4611734.1417714597653.JavaMail.root@sequans.com> |
| Date | Fri, 5 Dec 2014 05:05:25 +1100 |
| Subject | Re: Style question: Importing modules from packages - 'from' vs 'as' |
| 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.16573.1417716329.18130.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417716329 news.xs4all.nl 2885 [2001:888:2000:d::a6]:48218 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81927 |
Show key headers only | View raw
On Fri, Dec 5, 2014 at 4:36 AM, Jean-Michel Pichavant
<jeanmichel@sequans.com> wrote:
> I know you specifically stated you didn't want to do this but
>
> import os
>
> os.path.isfile()
>
> is the best option imo, especially from the reader point of view ("Namespaces are one honking great idea").
With os.path it definitely is. With the actual code in question, it's
a Python 2.7 project that mostly uses relative imports - inside
package.module1 is "import module2" etc - and I was writing an
external script that calls on one of the modules. So it makes sense to
reference it through the code the exact same way, as "module.blah"
rather than "package.module.blah".
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Style question: Importing modules from packages - 'from' vs 'as' Chris Angelico <rosuav@gmail.com> - 2014-12-05 05:05 +1100
csiph-web