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

Ian Kelly ian.g.kelly at gmail.com
Sat Nov 22 04:27:10 EST 2014


On Fri, Nov 21, 2014 at 6:07 PM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> On Friday, November 21, 2014 5:59:44 PM UTC-6, Chris Angelico wrote:
>> 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'
>>
>> [...]
>>
>> 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?
>
> Chris, either take the time to read and understand my posts
> *FULLY*, or don't bother to reply. I have in no way
> suggested that we import via "filepaths". Stop lying.

I see very little substantive difference between what Chris posted and
your suggestion of:

__search_path__ = ['/usr/local/lib/python3.5/lib-dynload']
import math

His comment about non-portability stands.



More information about the Python-list mailing list