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


Groups > comp.lang.python > #36720

Re: PyWart: Import resolution order

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <dihedral88888@googlemail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'package,': 0.03; 'importing': 0.04; 'case.': 0.05; 'paths': 0.05; 'python': 0.09; 'explanation': 0.09; 'friday,': 0.09; 'ide': 0.09; 'imported': 0.09; 'imports': 0.09; 'scripting': 0.09; 'throw': 0.09; 'to:addr:comp.lang.python': 0.09; 'translations': 0.09; 'cc:addr :python-list': 0.10; 'gui': 0.11; 'language,': 0.11; 'language': 0.14; 'clash': 0.16; "package's": 0.16; 'paths.': 0.16; 'renamed': 0.16; 'later': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'module,': 0.17; 'package.': 0.17; 'tries': 0.17; 'jan': 0.18; 'module': 0.19; 'math': 0.20; 'import': 0.21; '2.x': 0.22; 'explicit': 0.22; 'implicit': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; '(most': 0.27; 'correct': 0.28; 'chris': 0.28; 'helpful.': 0.29; 'usually': 0.30; 'fri,': 0.30; 'relative': 0.30; 'gets': 0.32; 'johnson': 0.32; 'could': 0.32; '11,': 0.33; 'strict': 0.33; 'received:google.com': 0.34; 'exist': 0.35; 'from:addr:googlemail.com': 0.35; 'path': 0.35; 'pm,': 0.35; 'sometimes': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'modules': 0.36; 'enough': 0.36; 'ok,': 0.37; 'does': 0.37; 'uses': 0.37; 'why': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'where': 0.40; 'think': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'containing': 0.61; 'first': 0.61; 'kind': 0.61; 'is.': 0.62; 'times': 0.63; 'skip:n 10': 0.63; 'decided': 0.65; 'choose': 0.65; 'commercial': 0.73; '"look': 0.84; '2013': 0.84; ':).': 0.84; 'first?': 0.84; 'subject:Import': 0.84; 'rick': 0.91
X-Received by 10.50.34.167 with SMTP id a7mr1004139igj.5.1358049383363; Sat, 12 Jan 2013 19:56:23 -0800 (PST)
Newsgroups comp.lang.python
Date Sat, 12 Jan 2013 19:56:22 -0800 (PST)
In-Reply-To <mailman.437.1357976236.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw
References <88bab977-ca49-487a-8fba-7d3350266d8d@googlegroups.com> <mailman.388.1357886143.2939.python-list@python.org> <2e407be7-2812-4c21-b91c-58e39b474bf7@googlegroups.com> <mailman.437.1357976236.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 123.192.32.215
MIME-Version 1.0
Subject Re: PyWart: Import resolution order
From 88888 Dihedral <dihedral88888@googlemail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc Python <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 <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>
Message-ID <mailman.458.1358049392.2939.python-list@python.org> (permalink)
Lines 86
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358049392 news.xs4all.nl 6982 [2001:888:2000:d::a6]:37044
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36720

Show key headers only | View raw


Ian於 2013年1月12日星期六UTC+8下午3時36分43秒寫道:
> On Fri, Jan 11, 2013 at 10:28 PM, Rick Johnson
> 
> <rantingrickjohnson@gmail.com> wrote:
> 
> > On Friday, January 11, 2013 12:30:27 AM UTC-6, Chris Angelico wrote:
> 
> >> Why is it better to import from the current directory first?
> 
> >
> 
> > Opps. I was not explicit enough with my explanation :). I meant, "look in the current directory FIRST when in a package". Since many times (most all times) packages will contain many sub-modules that need to be imported into the package's main.py module, and sometimes these modules will have the same name as a stdlib module, then looking in the package FIRST makes sense.
> 
> 
> 
> And again, in Python 2.x this is already the case.  When importing in
> 
> a package, it tries to do a relative import before it even looks at
> 
> sys.path.
> 
> 
> 
> > I think if python where *strict* about full paths for non-builtins, then we would be in a better place.
> 
> 
> 
> And again, in Python 3, where implicit relative imports have been
> 
> removed from the language, it already is strict about using full
> 
> paths.  You can still do relative imports, but you have to be explicit
> 
> about them.
> 
> 
> 
> > For instance you could create a package named "chris" and then have a module named math exist inside. Alternatively if you choose to be a non-professional and create a math module without a containing package, python would throw the module into the default "lib" package. The only way you could access your math module now would be by using the path "lib.math".
> 
> 
> 
> What if I create a package named "math"?  Does that also automatically
> 
> get renamed to "lib.math"?  How is it decided what package names are
> 
> proper; is it just because it happens to clash with a stdlib name that
> 
> the package gets magically renamed?
> 
> 
> 
> What if I create a package, and then later a module with the same name
> 
> happens to be added to the stdlib?  My program that uses the package
> 
> just breaks because it no longer imports the correct thing?
> 
> 
> 
> > Damn i am full of good ideas!
> 
> 
> 
> Your ideas might be better if you first spent some time gaining a
> 
> better understanding of how the language works as is.

OK, I think to develop a GUI with auto-code 
translations in an IDE  with python as the CAD/CAM scripting  language can be helpful.

But usually this kind of sotware projects is in the 
commercial part. 

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


Thread

PyWart: Import resolution order Rick Johnson <rantingrickjohnson@gmail.com> - 2013-01-10 22:13 -0800
  Re: PyWart: Import resolution order Chris Angelico <rosuav@gmail.com> - 2013-01-11 17:30 +1100
    Re: PyWart: Import resolution order Rick Johnson <rantingrickjohnson@gmail.com> - 2013-01-11 21:28 -0800
      Re: PyWart: Import resolution order Chris Angelico <rosuav@gmail.com> - 2013-01-12 17:03 +1100
      Re: PyWart: Import resolution order Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-12 00:36 -0700
        Re: PyWart: Import resolution order 88888 Dihedral <dihedral88888@googlemail.com> - 2013-01-12 19:56 -0800
        Re: PyWart: Import resolution order 88888 Dihedral <dihedral88888@googlemail.com> - 2013-01-12 19:56 -0800
    Re: PyWart: Import resolution order Rick Johnson <rantingrickjohnson@gmail.com> - 2013-01-11 21:28 -0800
      Re: PyWart: Import resolution order alex23 <wuwei23@gmail.com> - 2013-01-12 19:23 -0800
  Re: PyWart: Import resolution order Terry Reedy <tjreedy@udel.edu> - 2013-01-11 08:35 -0500
  Re: PyWart: Import resolution order Michael Torrie <torriem@gmail.com> - 2013-01-11 10:53 -0700
  Re: PyWart: Import resolution order Rick Johnson <rantingrickjohnson@gmail.com> - 2013-01-11 20:50 -0800
    Re: PyWart: Import resolution order alex23 <wuwei23@gmail.com> - 2013-01-11 23:44 -0800

csiph-web