Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41958
| References | <kio19e$5e2$1@ger.gmane.org> <mailman.3722.1364281502.2939.python-list@python.org> <2b893e00-8fac-4733-b07d-2041af850540@googlegroups.com> <20130326211657.GA1615@odell.Belkin> |
|---|---|
| Date | 2013-03-26 18:24 -0400 |
| Subject | Re: import in Python3.3 |
| From | Rocky Bernstein <rocky@gnu.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3781.1364336644.2939.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Tue, Mar 26, 2013 at 5:16 PM, Phil Connell <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, 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 > >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: import in Python3.3 Terry Reedy <tjreedy@udel.edu> - 2013-03-26 03:04 -0400
Re: import in Python3.3 rocky <rocky@gnu.org> - 2013-03-26 08:37 -0700
Re: import in Python3.3 Phil Connell <pconnell@gmail.com> - 2013-03-26 21:16 +0000
Re: import in Python3.3 Rocky Bernstein <rocky@gnu.org> - 2013-03-26 18:24 -0400
Re: import in Python3.3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-26 23:06 +0000
Re: import in Python3.3 rocky <rocky@gnu.org> - 2013-03-26 17:33 -0700
Re: import in Python3.3 rocky <rocky@gnu.org> - 2013-03-26 08:37 -0700
csiph-web