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


Groups > comp.lang.python > #102757 > unrolled thread

Re: Importing two modules of same name

Started bydieter <dieter@handshake.de>
First post2016-02-10 08:54 +0100
Last post2016-02-10 08:54 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Importing two modules of same name dieter <dieter@handshake.de> - 2016-02-10 08:54 +0100

#102757 — Re: Importing two modules of same name

Fromdieter <dieter@handshake.de>
Date2016-02-10 08:54 +0100
SubjectRe: Importing two modules of same name
Message-ID<mailman.1.1455090890.22075.python-list@python.org>
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").

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web