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


Groups > comp.lang.python > #81950

Re: Style question: Importing modules from packages - 'from' vs 'as'

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; "subject:' ": 0.07; 'os.path': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:modules': 0.09; 'subject:question': 0.10; 'python': 0.11; '2.7': 0.14; 'mostly': 0.14; 'imports': 0.16; 'modules.': 0.16; 'received:80.91.229.3': 0.16; 'received:mediaways.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:pool.mediaways.net': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; '2.x': 0.24; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'external': 0.29; 'feature': 0.29; 'relative': 0.30; "i'm": 0.30; 'code': 0.31; 'usually': 0.31; 'implicit': 0.31; 'actual': 0.34; 'subject:from': 0.34; 'etc': 0.35; 'but': 0.35; 'project': 0.37; 'question,': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'is.': 0.60
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
Subject Re: Style question: Importing modules from packages - 'from' vs 'as'
Date Thu, 04 Dec 2014 21:56:44 +0100
References <CAPTjJmo1-QCgcbsjKNgH3oN-nm5qjB5GrvCiC6Qc9p+S8cNjpg@mail.gmail.com> <2047880662.4611734.1417714597653.JavaMail.root@sequans.com> <CAPTjJmpgM2n=AdY+8gZ40gqe1S2zfD83Ui-f5SngRYLA3jMtCQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host frbg-5f7310fe.pool.mediaways.net
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
In-Reply-To <CAPTjJmpgM2n=AdY+8gZ40gqe1S2zfD83Ui-f5SngRYLA3jMtCQ@mail.gmail.com>
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.16587.1417726622.18130.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417726622 news.xs4all.nl 2845 [2001:888:2000:d::a6]:57011
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81950

Show key headers only | View raw


On 04.12.2014 19:05, Chris Angelico wrote:
>
> 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.

What ? I'm usually thinking Python 3 not 2 and I'm never sure which 
Python 2.x has backported which feature of 3, but I thought implicit 
relative imports like you seem to describe are not working in 2.7 ?

Wolfgang

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


Thread

Re: Style question: Importing modules from packages - 'from' vs 'as' Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-12-04 21:56 +0100

csiph-web