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


Groups > comp.lang.python > #2265

Forcing absolute package imports in 2.7?

From Michael Parker <michael.g.parker@gmail.com>
Date 2011-03-30 19:26 -0700
Subject Forcing absolute package imports in 2.7?
Newsgroups comp.lang.python
Message-ID <mailman.23.1301538403.2990.python-list@python.org> (permalink)

Show all headers | View raw


Hi all,

I'm reading Learning Python 4th Edition by Lutz. In the section on
relative package imports, he says: "In Python 3.0, the `import
modname` statement is always absolute, skipping the containing
package’s directory. In 2.6, this statement form still performs
relative imports today (i.e., the package’s directory is searched
first), but these will become absolute in Python 2.7, too.`

But in my own testing I'm not seeing this behavior. Was it not
included in 2.7 for fear of breaking too many programs?

Thanks!
- Mike

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


Thread

Forcing absolute package imports in 2.7? Michael Parker <michael.g.parker@gmail.com> - 2011-03-30 19:26 -0700
  Re: Forcing absolute package imports in 2.7? aahz@pythoncraft.com (Aahz) - 2011-04-13 16:10 -0700

csiph-web