Re: PEP 420 issue: extend_path

Barry Warsaw <[email protected]>
Newsgroups gmane.comp.python.import
Organization The Organization of Unorganized Woozalists
Message-ID <20120509091429.776ae7bd@resist>
On May 09, 2012, at 06:19 PM, Nick Coghlan wrote:

>Eric's counter-proposal is to handle the 3 scenarios as:
>
>1. (<loader>, <don't care>)
>2. (None, [<path entries>])
>3. (None, [])

This seems quite Pythonic to me, and even convenient.  With this API, you know
that you're getting a 2-tuple, so you don't have to check the length of the
return type to know how to unpack it.  Then, you only need to check the first
element to know whether you've got a loader or not.  This also seems like a
straightforward elaboration of the older find_module() API (i.e. the first
element's return values are exactly like the single return value of
find_module()).

Take a look at the PathFinder.find_module() implementation to see how clear
and concise this API is.

I'd like to relax the formal specification just a bit though, so that the
second element is a sequence, not necessarily a concrete list.

Cheers,
-Barry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.