Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!postnews.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!panix!panix5.panix.com!not-for-mail From: aahz@pythoncraft.com (Aahz) Newsgroups: comp.lang.python Subject: Re: Forcing absolute package imports in 2.7? Date: 13 Apr 2011 16:10:06 -0700 Organization: The Cat & Dragon Lines: 20 Message-ID: References: NNTP-Posting-Host: panix5.panix.com X-Trace: reader1.panix.com 1302736207 10073 166.84.1.5 (13 Apr 2011 23:10:07 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 13 Apr 2011 23:10:07 +0000 (UTC) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3140 In article , Michael Parker wrote: > >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=92s directory. In 2.6, this statement form still performs >relative imports today (i.e., the package=92s 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? from __future__ import absolute_import -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found it useful to short-circuit any doubt and just refer to comments in code as 'lies'. :-)" --Michael Foord paraphrases Christian Muirhead on python-dev, 2009-03-22