[Python-ideas] PEP: Distributing a Subset of the Standard Library

Guido van Rossum guido at python.org
Mon Nov 28 15:00:55 EST 2016


On Mon, Nov 28, 2016 at 11:54 AM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 11/28/2016 11:38 AM, Guido van Rossum wrote:
>
>> Overall I think this is a good idea. I have one hit:
>>
>> It seems that there are two possible strategies for searching the
>> .missing.py file:
>>
>> 1. (Currently in the PEP) search it at the same time as the .py file
>> when walking along sys.path.
>>   - Pro: prevents confusion when the user accidentally has their own
>> matching file later in sys.path.
>>   - Con: prevents the user from installing a matching file intentionally
>> (e.g. a 3rd party version).
>>
>> 2. After exhausting sys.path, search it again just for .missing.py files
>> (or perhaps remember the location of the .missing.py file during the
>> first search but don't act immediately on it -- this has the same effect).
>>   - Pro: allows user to install their own version.
>>
>
> The Windows distribution. for instance, could have a mod.missing.py file
> for every non-Windows, unix-only module.  This would cut down on 'Why did
> this import fail?' questions on SO and python-list.  And without breaking
> anything. Even for non-beginners, it would save having to look up whether
> the an import failure is inherent on the platform or due to a typo.
>

Yes, this is why I like the proposal (but it would still have this benefit
with option (2)).


>   - Con: if the user has a matching file by accident, that file will be
>> imported, causing more confusion.
>>
>> I personally would weigh these so as to prefer (2). The option of
>> installing your own version when the standard version doesn't exist
>> seems reasonable; there may be reasons that you can't or don't want to
>> install the distribution's version. I don't worry much about the danger
>> of accidental name conflicts (have you ever seen this?).
>>
>
> The accidental conflict reports I have seen were due to scripts in as in
> the same directory as the program, rather than modules in site-packages.


Yes we get those occasionally -- but do those ever happen specifically for
stdlib module names that aren't installed because the platform doesn't
support them or requires them to be installed separately? I.e. would the
.missing.py feature actually have benefitted those reports?

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161128/75306acf/attachment-0001.html>


More information about the Python-ideas mailing list