Forcing absolute package imports in 2.7?

Michael Parker michael.g.parker at gmail.com
Wed Mar 30 22:26:22 EDT 2011


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



More information about the Python-list mailing list