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


Groups > comp.lang.python > #2265

Forcing absolute package imports in 2.7?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.alphanet.ch!alphanet.ch!news.imp.ch!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <michael.g.parker@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '(i.e.,': 0.03; '2.7': 0.05; 'behavior.': 0.07; 'imports': 0.07; 'skipping': 0.07; 'python': 0.07; '3.0,': 0.09; 'subject:2.7': 0.09; '2.6,': 0.16; 'first),': 0.16; 'programs?': 0.16; 'subject:package': 0.16; 'thanks!': 0.18; 'seeing': 0.21; 'breaking': 0.23; 'directory.': 0.23; 'statement': 0.26; "i'm": 0.26; 'message- id:@mail.gmail.com': 0.28; 'testing': 0.28; 'subject:?': 0.29; '"in': 0.31; 'performs': 0.31; 'all,': 0.31; 'to:addr:python- list': 0.32; 'too': 0.36; 'received:209.85': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'mike': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'containing': 0.40; 'header:Received:5': 0.40; 'edition': 0.60; 'charset:windows-1252': 0.61; '4th': 0.69; 'today': 0.70; 'become': 0.70; 'fear': 0.73
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=EywTvYi7MgEaHgOhmR1o5d2nGv90leVNH+Prsk6BLg8=; b=hXjMUDV5XPFEPZUAanJDbRdhgkY295vc7tNI4uiWlW7TAJdog1bQ8QvjC3S2KLUXg4 2YrT8Q61U5AWMaTfP/My0o7/KKiMDbAkZlhza+o/zWdhudOwn/ZLT1wtld7ZNDqbYgpD Nl0VYDLJxed5OmVspkSjQRNFh/uD2jLCxFHwI=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; b=KGCUOotI41iUcIIH7IQFLFZzZsd/tl1gDeNVSEA0dNyzgvX2fjuxhFOppc+omFH8ow T9G181YqL6HivG/AgScYtiphyHkxhaF4Mhfv31PTwXGPYamQ8XXQ+sbjJUr9wNogqsbf ImJqVTIau7U01rgsljIhyUQWxKt/IPBF7yQl4=
MIME-Version 1.0
From Michael Parker <michael.g.parker@gmail.com>
Date Wed, 30 Mar 2011 19:26:22 -0700
Subject Forcing absolute package imports in 2.7?
To python-list@python.org
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.23.1301538403.2990.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 82.94.164.166
X-Trace 1301538403 news.xs4all.nl 41103 [::ffff:82.94.164.166]:35526
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2265

Show key headers only | 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