[Python-ideas] PEP: Distributing a Subset of the Standard Library
Chris Barker
chris.barker at noaa.gov
Mon Nov 28 16:39:09 EST 2016
On Mon, Nov 28, 2016 at 1:26 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> > One "successful" use-case that would be impacted is the fallback import
> > idiom:
> >
> > try:
> > # this would do two full searches before getting the error
> > import BlahBlah
> > except ImportError:
> > import blahblah
>
> Under this proposal, the above idiom could potentially now fail.
higher on the thread, someone said that IMportError was not robust enough,
because it didn't give near,y as meaninful an error message as it might.
> There's no guarantee that I can see that a .missing.py file
> would raise ImportError (even if we said that was the intended
> behaviour, there's nothing to enforce it).
>
there is nothing to enforce all sorts of things -- I dont hinkt it's so
wrong to have it in the spec that .missing.py fles NEED to raise an
ImportError
and they could give nice meaningful error messages that way without
breaking old code.
Could the proposal execute the .missing.py file and then raise
> ImportError? I could imagine that having problems of its own,
> though...
if the ImportError is raised by the surrounding code, then it would need a
protocol to get the nice error message -- raising an Exception is already a
protocol -- let's use that one.
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161128/d39dbd89/attachment-0001.html>
More information about the Python-ideas
mailing list