[Python-Dev] Clarifications for import PEPs (302 and 328)
brett at python.org
Tue Apr 24 00:16:44 CEST 2007
On 4/23/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 02:01 PM 4/23/2007 -0700, Brett Cannon wrote:
> >For PEP 302, a loader should raise ImportError if load_module fails
> >w/o an explicit exception being raised.
> I'm not sure I understand this; could you point to the relevant part of the
> PEP and what you would be adding? Thanks.
The PEP does not explicitly state how to signal that a loader cannot
load a module it is asked to. This could happen if someone called a
loader without consulting its respective importer. I would want to
add something like:
If the loader is unable to load the specified module and a specific
exception is not raised in determining this, ImportError is raised.
This may occur if a loader is called without first consulting an
importer as to if the loader can load the specified module but the
loader is aware of the fact it cannot fulfill the request made.
> (The rest of your comments sounded fine, btw.)
More information about the Python-Dev