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


Groups > comp.lang.python > #41937

Re: import in Python3.3

Newsgroups comp.lang.python
Date 2013-03-26 11:41 -0700
References <mailman.3685.1364166787.2939.python-list@python.org> <514f9a0b$0$30001$c3e8da3$5496439d@news.astraweb.com> <0f669e21-5fd1-402e-9d96-55aa647d1030@googlegroups.com> <mailman.3754.1364315646.2939.python-list@python.org>
Subject Re: import in Python3.3
From rocky <rocky@gnu.org>
Message-ID <mailman.3766.1364323326.2939.python-list@python.org> (permalink)

Show all headers | View raw


On Tuesday, March 26, 2013 12:33:54 PM UTC-4, Jerry Hill wrote:
> On Mon, Mar 25, 2013 at 11:49 PM, rocky wrote:
> 
> >> On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote:
> 
> >> > I have a package name collections and inside of my package I want to
> 
> 
> 
> > I find this kind of thing sad: it feels to me that programmers are working around somewhat arbitrary and changing restrictions. Rather than avoid names like "collections", why not try to address the underlying problem? There isn't an ambiguity here in my view: the fullname is mypackage.collections
> 
> 
> 
> You've said a couple of times now that the original author has a
> 
> package named "mypackage" with a module "collections" in it.  As far
> 
> as I can tell, that's untrue.  The original post claims to have a
> 
> package named "collections", which is colliding with the builtin
> 
> module of the same name.
> 
> 
> 
> As far as I can tell, all of your suggestions about using your
> 
> pyimport-relative tool aren't helpful unless the author re-names his
> 
> package from "collections" to "mypackage" and then moves all of their
> 
> code into a "collections" module inside "mypackage", right?

Right. Perhaps then I misunderstand. Having a package called "collections" when there is something out there already called "collections" clearly ill advised. 

But in that case, using sys.path to get around this is still a bad idea: the clash should be fixed. Sure, only in the case that this really can't be addressed would I use sys.path.

> 
> 
> 
> -- 
> 
> Jerry

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

import in Python3.3 Fabian von Romberg <fromberg100@hotmail.com> - 2013-03-24 18:12 -0500
  Re: import in Python3.3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-25 00:27 +0000
    Re: import in Python3.3 Fabian von Romberg <fromberg100@hotmail.com> - 2013-03-24 20:39 -0500
    Re: import in Python3.3 rocky <rocky@gnu.org> - 2013-03-25 20:49 -0700
      Re: import in Python3.3 Jerry Hill <malaclypse2@gmail.com> - 2013-03-26 12:33 -0400
        Re: import in Python3.3 rocky <rocky@gnu.org> - 2013-03-26 11:41 -0700
        Re: import in Python3.3 rocky <rocky@gnu.org> - 2013-03-26 11:41 -0700
        Re: import in Python3.3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-26 23:11 +0000

csiph-web