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


Groups > comp.lang.python > #102770

Re: Importing two modules of same name

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Tim Johnson <tim@akwebsoft.com>
Newsgroups comp.lang.python
Subject Re: Importing two modules of same name
Date Wed, 10 Feb 2016 10:26:48 -0900
Organization AkWebsoft
Lines 19
Message-ID <mailman.19.1455132411.22075.python-list@python.org> (permalink)
References <20160209232303.GC2583@mail.akwebsoft.com> <56BA7809.1000206@oddbird.net> <87y4atngot.fsf@handshake.de>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace news.uni-berlin.de zd/+aGfme7AsRpu7fV+IsgNLoODrallea5+i8kvv7hsg==
Return-Path <tim@akwebsoft.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'builtin': 0.07; 'omit': 0.07; 'subject:two': 0.07; 'globals': 0.09; 'parameter.': 0.09; 'subject:modules': 0.09; 'subject:same': 0.09; 'python': 0.10; 'received:io': 0.16; 'received:psf.io': 0.16; 'config': 0.18; 'thanks.': 0.18; 'default,': 0.22; 'parameter': 0.22; 'import': 0.24; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'specify': 0.27; 'function': 0.28; 'developing': 0.28; 'cgi': 0.29; 'indirectly': 0.29; 'sites.': 0.29; 'allows': 0.30; 'there': 0.36; 'framework': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'to:addr:python.org': 0.40; 'meyer': 0.84; 'package"': 0.91
Mail-Followup-To python-list@python.org
Content-Disposition inline
In-Reply-To <87y4atngot.fsf@handshake.de>
User-Agent Mutt/1.5.21 (2010-09-15)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
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>
Xref csiph.com comp.lang.python:102770

Show key headers only | View raw


* dieter <dieter@handshake.de> [160209 23:03]:
> Carl Meyer <carl@oddbird.net> writes:
> > ...
> > If you omit the future-import in Python 2.7, `import config` will import
> > the neighboring app/config.py by default, and there is no way to import
> > the top-level config.py.
> 
> There is the "__import__" builtin function which allows to specify
> the "parent package" indirectly via its "globals" parameter. This
> way, you can import the "top-level" config (passing an empty "globals").
  Thanks.
  I used __import__ as part of a custom load() function that I used
  in my own framework when I was developing CGI sites. I never used
  the globals parameter tho'.
  If I start

-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com

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


Thread

Re: Importing two modules of same name Tim Johnson <tim@akwebsoft.com> - 2016-02-10 10:26 -0900

csiph-web