Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'ambiguity': 0.09; 'pep': 0.09; "they've": 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '328': 0.16; 'collections': 0.16; 'exist.': 0.16; 'from:addr:gnu.org': 0.16; 'subject:import': 0.16; 'sys.path': 0.16; 'language': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'do.': 0.18; 'pfxlen:0': 0.19; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In- Reply-To:1': 0.27; 'url:code': 0.29; 'relative': 0.30; 'message- id:@mail.gmail.com': 0.30; 'asked': 0.31; '-0700,': 0.31; 'probably': 0.32; 'worked': 0.33; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'impression': 0.36; "didn't": 0.36; 'should': 0.36; 'error.': 0.37; 'searching': 0.37; 'wrong': 0.37; 'pm,': 0.38; 'mentioned': 0.61; 'places': 0.64; 'url:p': 0.64; 'to:addr:gmail.com': 0.65; 'details': 0.65; 'mar': 0.68; '26,': 0.68; 'wish': 0.70; 'phil': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=oIvPkKgDr/QBj3h4GWl1xgGwBxuaw9MPvQkGmQkHAxI=; b=EgpdDd6mC7Xyw7umZwcdC3Mg0QdNNU56fJtlXtEdqTrFI4n6Ze9Z6LTe+HrGJvvVqs 3RCAsw4i5+nX62Lwnn3yrLSzQTcWI0en2zTN5KY/As0WVNq/T9gnyUi1wwBRHMTDqyS+ rG/TOJlBd2s/SvaONTie0JGs4XPggcyAEUAgvlMzjgBoqJbduP7IpwtYwfr2SP/tLwai cLYOR/2yjl6mYCPfxTuIMe9HxdXl9WTzlej52ZZdahtIBinf2qhA2bzzsGRlEk/kaDrs Kir6fE6Gaovbhtpi6JMGYNZIDToZsJqEE7KCg/70TFpy6gQplwwhgJ3T4q38l4ZoG0mC RWDg== MIME-Version: 1.0 X-Received: by 10.180.185.239 with SMTP id ff15mr6084627wic.2.1364336642572; Tue, 26 Mar 2013 15:24:02 -0700 (PDT) Sender: rocky.bernstein@gmail.com In-Reply-To: <20130326211657.GA1615@odell.Belkin> References: <2b893e00-8fac-4733-b07d-2041af850540@googlegroups.com> <20130326211657.GA1615@odell.Belkin> Date: Tue, 26 Mar 2013 18:24:02 -0400 X-Google-Sender-Auth: eBABgjcCFst6c3SAE8dD2mA1puo Subject: Re: import in Python3.3 From: Rocky Bernstein To: Phil Connell Content-Type: multipart/alternative; boundary=001a11c34dc2ef487e04d8db6028 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 84 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364336644 news.xs4all.nl 6882 [2001:888:2000:d::a6]:46179 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41958 --001a11c34dc2ef487e04d8db6028 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Mar 26, 2013 at 5:16 PM, Phil Connell wrote: > On Tue, Mar 26, 2013 at 08:37:00AM -0700, rocky wrote: > > And again, I get the impression that for the use case asked about, there > isn't much ambiguity. If I am in mypackage.foo and I want to access > mypackage.collections I should be able to say something like that without > ambiguity or that much inference or directory searching. If > mypackage.colletions is not found inside the same directory as > mypackage.foo, often I DON'T WANT Python to helpfully go searching around > other places for it which sys.path will do. Instead what I probably want is > Python to give me an error. > > > > So again I come to import_relative, > http://code.google.com/p/pyimport-relative/. And again, I wish this > package didn't have to exist. > > What's wrong with PEP 328 relative imports? > They've never worked for me. Some details are mentioned that in the link above. If it works for you, great, use it. > In mypackage.foo, use > > from . import collections > > to import mypackage.collections. > > > This has been part of the language since ~2.5 > > --001a11c34dc2ef487e04d8db6028 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Tue, Mar 26, 2013 at 5:16 PM, Phil Co= nnell <pconnell@gmail.com> wrote:
On Tue, Mar 26, 2013 at 08:37:00AM -0700, rocky wrote:
> And again, I get the impression that for the use case asked about, the= re isn't much ambiguity. If I am in mypackage.foo and I want to access = mypackage.collections I should be able to say something like that without a= mbiguity or that much inference or directory searching. If mypackage.collet= ions is not found inside the same directory as mypackage.foo, often I DON&#= 39;T WANT Python to helpfully go searching around other places for it which= sys.path will do. Instead what I probably want is Python to give me an err= or.
>
> So again I come to import_relative, http://code.google.com/p/pyimport-r= elative/. =A0And again, I wish this package didn't have to exist.
What's wrong with PEP 328 relative imports?

They've never worked for me. Some details are mentioned that i= n the link above.=A0

If it works for you, great, u= se it.


In mypackage.foo, use

=A0 =A0 from . import collections

to import mypackage.collections.


This has been part of the language since ~2.5


--001a11c34dc2ef487e04d8db6028--