PyWart: "Python's import statement and the history of external dependencies"
Chris Angelico
rosuav at gmail.com
Fri Nov 21 18:52:33 EST 2014
More information about the Python-list mailing list
Fri Nov 21 18:52:33 EST 2014
- Previous message (by thread): PyWart: "Python's import statement and the history of external dependencies"
- Next message (by thread): Import a module from a specific file path (was: PyWart: "Python's import statement and the history of external dependencies")
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Nov 22, 2014 at 10:21 AM, Rick Johnson <rantingrickjohnson at 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
- Previous message (by thread): PyWart: "Python's import statement and the history of external dependencies"
- Next message (by thread): Import a module from a specific file path (was: PyWart: "Python's import statement and the history of external dependencies")
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list