[Import-SIG] PEP 420 issue: extend_path

Eric V. Smith eric at trueblade.com
Wed May 9 02:16:22 CEST 2012


On 05/08/2012 10:07 AM, Eric V. Smith wrote:

> I don't disagree with this. But we've got a function that we're asking
> to return one of 2 things, as you say. How is this normally handled? I
> would not use a callback. I'd return a tuple with the two things:
> (loader, list_of_portions). That seems way more straightforward.

In the pep-420 branch I've checked in code where find_loader() returns
(loader, list_of_portions). I've implemented it for the FileFinder and
zipimport.

loader can be None or a loader object.
list_of_portions can be an empty list, or a list of strings.

To indicate "no loader or portions found", return (None, []).

If loader is not None, list_of_portions is ignored.

I'm pretty happy with this API. Comments welcome.

Eric.



More information about the Import-SIG mailing list