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


Groups > comp.lang.python > #102770

Re: Importing two modules of same name

From Tim Johnson <tim@akwebsoft.com>
Newsgroups comp.lang.python
Subject Re: Importing two modules of same name
Date 2016-02-10 10:26 -0900
Organization AkWebsoft
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>

Show all headers | 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