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


Groups > comp.lang.python > #81256

Re: PyWart: "Python's import statement and the history of external dependencies"

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'explicit': 0.07; 'linux,': 0.07; 'paths': 0.07; 'sys': 0.07; '22,': 0.09; 'method,': 0.09; 'windows,': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; '*any*': 0.16; 'bsd,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hard- code': 0.16; 'path.': 0.16; 'resolutions,': 0.16; 'subject:dependencies': 0.16; 'subject:import': 0.16; 'throw': 0.16; 'unchanged': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'mechanism': 0.19; 'work,': 0.20; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'os,': 0.31; 'file': 0.32; 'cases': 0.33; 'mac': 0.33; 'subject:the': 0.34; 'johnson': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'words,': 0.36; 'method': 0.36; 'nov': 0.38; 'expect': 0.39; 'realize': 0.39; 'use.': 0.39; 'how': 0.40; 'subject:"': 0.60; 'most': 0.60; 'tell': 0.60; 'new': 0.61; 'advanced': 0.63; 'name': 0.63; 'more': 0.64; 'taking': 0.65; 'techniques': 0.66; 'details,': 0.68; "today's": 0.70; 'day': 0.76; 'heavy': 0.81; './configure': 0.84; 'itself?': 0.84; 'situations,': 0.84; 'subject:history': 0.84; 'on?': 0.91; 'to:none': 0.92; 'rick': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=UjlQVknHNfkpUiat4rPjgcrk48Zhdq2y+pXN1oTEq5M=; b=Qb3RB+Yuu7qt+0ONXhEPS4FCKnI40UYienIQUfssqUicERQF81XgXJmRjpplOhn00f Q0Uv0tKXOEGzmAGOEh5BCGGKboEw1L5h5vvIX2CkwUaEqfRMj9k/xtKJnhtmcCPsSnaV +9lHtmGqEzOXBwqg6kRQJ4ADLJy2bWar7Bgu9lNlhEAIdc5PP+6IHTER+ZKzMeX4O9Ej KkGgErCuiQqfw2iCTASupJxebMXSierpWN8z4SznLZGxEZ9Vi8dpYF0j6v3NCyOPPqOI x3jFtCwOf5E6Q7v5NbtJxB4wqgnHTAtdRQzD6lMuVKNRXFaLvtBV9G444JmxiKbqU5nG WB2A==
MIME-Version 1.0
X-Received by 10.50.178.212 with SMTP id da20mr902010igc.34.1416613954178; Fri, 21 Nov 2014 15:52:34 -0800 (PST)
In-Reply-To <a2184638-9fd0-4988-8528-cace9786041f@googlegroups.com>
References <066c46c8-a04d-4489-b15a-b603c1b1818b@googlegroups.com> <m4m04r$aeg$1@dont-email.me> <8661e407-4472-4208-97c2-f666f6502c67@googlegroups.com> <mailman.16104.1416584077.18130.python-list@python.org> <0bbe1c60-2b29-40f6-96e1-ac777f0c276f@googlegroups.com> <mailman.16121.1416597880.18130.python-list@python.org> <08867178-abb6-4703-9ac5-2a53acb5d227@googlegroups.com> <a2184638-9fd0-4988-8528-cace9786041f@googlegroups.com>
Date Sat, 22 Nov 2014 10:52:33 +1100
Subject Re: PyWart: "Python's import statement and the history of external dependencies"
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16127.1416614372.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416614372 news.xs4all.nl 2893 [2001:888:2000:d::a6]:44011
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81256

Show key headers only | View raw


On Sat, Nov 22, 2014 at 10:21 AM, Rick Johnson
<rantingrickjohnson@gmail.com> wrote:
> 1. Use the historical "implicit import" mechanism for most day
> to day imports, and let Python do all the heavy lifting.
>
> 2. Use the new "explicit import" mechanism for advanced name
> resolutions, but realize that since you are now taking
> control of import, so you must do more work, and you must be
> "exhaustively explicit" about *where* Python searches.

In other words, what you want is:

# today's method, import based on search path
import sys
# new explicit path method
import '/usr/local/lib/python3.5/lib-dynload/math.cpython-35m.so'

Can you tell me, please, how this is going to work for *any* system
other than the one it was built on? One of the reasons I write Python
code is because I expect it to work unchanged on Windows, Linux, Mac
OS, BSD, OS/2, uPy, and any other platform I care to throw it onto. If
I want to hard-code all the details, I might as well write C code and
at least take advantage of ./configure to work out the right paths for
me.

There are a VERY VERY few cases where you really do want to import a
module from a specific file path. For those situations, there are
already techniques you can use. Why change the behaviour of import
itself?

ChrisA

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


Thread

PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-15 21:01 -0800
  Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-16 16:16 +1100
  Re: PyWart: "Python's import statement and the history of external dependencies" alex23 <wuwei23@gmail.com> - 2014-11-21 10:14 +1000
    Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-21 11:31 +1100
    Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-20 19:53 -0800
      Re: PyWart: "Python's import statement and the history of external dependencies" Tim Chase <python.list@tim.thechases.com> - 2014-11-21 04:26 -0600
        Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-21 07:52 -0800
          Re: PyWart: "Python's import statement and the history of external dependencies" Tim Chase <python.list@tim.thechases.com> - 2014-11-21 10:12 -0600
          Re: PyWart: "Python's import statement and the history of external dependencies" Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-21 10:42 -0700
      Re: PyWart: "Python's import statement and the history of external dependencies" Ned Batchelder <ned@nedbatchelder.com> - 2014-11-21 06:32 -0500
      Re: PyWart: "Python's import statement and the history of external dependencies" Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-21 08:33 -0700
        Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-21 10:24 -0800
          Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-22 05:34 +1100
          Re: PyWart: "Python's import statement and the history of external dependencies" Michael Torrie <torriem@gmail.com> - 2014-11-21 12:05 -0700
            Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-21 12:29 -0800
              Re: PyWart: "Python's import statement and the history of external dependencies" Michael Torrie <torriem@gmail.com> - 2014-11-21 15:54 -0700
          Re: PyWart: "Python's import statement and the history of external dependencies" Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-21 12:23 -0700
            Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-21 14:25 -0800
              Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-21 15:21 -0800
                Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-22 10:52 +1100
                Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-21 17:07 -0800
                Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-22 13:36 +1100
                Re: PyWart: "Python's import statement and the history of external dependencies" Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-22 02:27 -0700
                Re: PyWart: "Python's import statement and the history of external dependencies" sohcahtoa82@gmail.com - 2014-11-21 16:33 -0800
                Import a module from a specific file path (was: PyWart: "Python's import statement and the history of external dependencies") Ben Finney <ben+python@benfinney.id.au> - 2014-11-22 11:37 +1100
                Re: Import a module from a specific file path Marko Rauhamaa <marko@pacujo.net> - 2014-11-22 08:28 +0200
                Re: Import a module from a specific file path (was: PyWart: "Python's import statement and the history of external dependencies") Chris Angelico <rosuav@gmail.com> - 2014-11-22 13:32 +1100
                Re: Import a module from a specific file path Ben Finney <ben+python@benfinney.id.au> - 2014-11-22 17:46 +1100
              Re: PyWart: "Python's import statement and the history of external dependencies" Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-21 17:32 -0700
                Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-21 17:48 -0800
          Re: PyWart: "Python's import statement and the history of external dependencies" Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-21 15:38 -0500
        Re: PyWart: "Python's import statement and the history of external dependencies" Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-22 23:25 +1100
          Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-23 00:00 +1100
            Re: PyWart: "Python's import statement and the history of external dependencies" Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-23 17:30 +1100
              Re: PyWart: "Python's import statement and the history of external dependencies" Rustom Mody <rustompmody@gmail.com> - 2014-11-22 22:44 -0800
              Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-23 17:56 +1100
              Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-23 17:59 +1100
                Re: PyWart: "Python's import statement and the history of external   dependencies" Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-24 11:37 +1300
                Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-23 22:25 -0800
                Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-24 17:34 +1100
                Re: PyWart: "Python's import statement and the history of external dependencies" Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-24 10:34 +0000
                Re: PyWart: "Python's import statement and the history of external dependencies" Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-24 08:51 -0800
                Re: PyWart: "Python's import statement and the history of external dependencies" Ned Batchelder <ned@nedbatchelder.com> - 2014-11-24 12:06 -0500
                Re: PyWart: "Python's import statement and the history of external dependencies" Robin Becker <robin@reportlab.com> - 2014-11-24 17:07 +0000
                Re: PyWart: "Python's import statement and the history of external dependencies" Marko Rauhamaa <marko@pacujo.net> - 2014-11-24 19:08 +0200
                Re: PyWart: "Python's import statement and the history of external dependencies" Rustom Mody <rustompmody@gmail.com> - 2014-11-24 09:38 -0800
                Re: PyWart: "Python's import statement and the history of external dependencies" Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-24 15:34 -0700
              Re: PyWart: "Python's import statement and the history of external dependencies" Ben Finney <ben+python@benfinney.id.au> - 2014-11-23 18:43 +1100
              Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-23 18:51 +1100
              Re: PyWart: "Python's import statement and the history of external dependencies" Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-23 11:23 -0500
              Re: PyWart: "Python's import statement and the history of external dependencies" Chris Angelico <rosuav@gmail.com> - 2014-11-24 03:36 +1100
          Re: PyWart: "Python's import statement and the history of external dependencies" Tim Chase <python.list@tim.thechases.com> - 2014-11-22 15:27 -0600
            Re: PyWart: "Python's import statement and the history of external dependencies" Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-23 12:00 +1100
              Re: PyWart: "Python's import statement and the history of external dependencies" Tim Chase <python.list@tim.thechases.com> - 2014-11-22 19:33 -0600

csiph-web