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


Groups > comp.lang.python > #96262

Re: Question about import

Path csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!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; 'needed,': 0.05; 'subject:Question': 0.05; 'namespace': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thu,': 0.15; 'collapse': 0.16; 'missing?': 0.16; 'module?': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:import': 0.16; 'wrote:': 0.16; 'project,': 0.18; 'language': 0.19; '2015': 0.20; 'explicit': 0.22; 'sep': 0.22; 'am,': 0.23; 'import': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; 'wonder': 0.27; 'question': 0.27; "skip:' 10": 0.28; 'fine': 0.28; 'if,': 0.29; 'url:peps': 0.29; "i'm": 0.30; 'that.': 0.30; "we're": 0.30; 'another': 0.32; 'useful': 0.33; 'url:python': 0.33; 'that,': 0.34; 'c++': 0.35; 'url:dev': 0.35; 'but': 0.36; 'url:org': 0.36; 'modules': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'one,': 0.37; 'thought': 0.37; 'names': 0.38; 'rather': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'some': 0.40; 'waiting': 0.60; 'different': 0.63; 'qualified': 0.63; 'you.': 0.64; 'features:': 0.66; 'reuse': 0.66; "they're": 0.66; 'experts': 0.70; 'frank': 0.72; 'incredibly': 0.76
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Question about import
Date Thu, 10 Sep 2015 16:47:16 +0200
Organization None
References <msrah1$sju$1@ger.gmane.org> <CALwzidm3khNaGTt0OhVEo5bhqk1tFEjBUUUinW9TNUxrpnr8cw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p57bd8163.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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.319.1441896793.8327.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1441896793 news.xs4all.nl 23734 [2001:888:2000:d::a6]:57933
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96262

Show key headers only | View raw


Ian Kelly wrote:

> On Thu, Sep 10, 2015 at 1:12 AM, Frank Millman <frank@chagford.com> wrote:
>> That makes me wonder if, in my project, I can import all modules inside
>> 'start.py', and then just use 'import package_name' inside each module?
> 
> You can, but for readability and reuse I think it's better to be
> explicit in each module and import the fully qualified module names
> that are needed, rather than relying on some other module to import
> them for you.
> 
>> Another question - I thought that, because aa.py and bb.py are in
>> different sub-directories, I would have to set them up as packages by
>> adding '__init__.py' to each one, but it works fine without that. What am
>> I missing?
> 
> That surprises me also, but I suspect it's because they're
> subdirectories of the current working directory rather than packages
> found on the sys.path.

So even the experts cannot keep up with all those nifty new features:

https://www.python.org/dev/peps/pep-0420/ (Implicit Namespace Packages)

I'm waiting to see the language collapse under all its nice and -- seen in 
isolation -- incredibly useful additions. 

C++ we're coming :(

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


Thread

Re: Question about import Peter Otten <__peter__@web.de> - 2015-09-10 16:47 +0200

csiph-web