Re: PEP 420 issue: extend_path
"Eric V. Smith" <[email protected]>
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <[email protected]> |
On 5/8/2012 12:09 PM, PJ Eby wrote: > On Tue, May 8, 2012 at 10:07 AM, Eric V. Smith <[email protected] > <mailto:[email protected]>> 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. > > > +1. It's also easy to implement. > > I'm not sure why we *need* a list of portions, but if we do, simple > return values seem like the way to go. But the 2-element tuple wins > even in the single path portion case, and the tuple-return protoocol is > extensible if we need more data returned in future anyway. Nick laid out a use case in a previous email. It makes sense to me. For example, a zip file could contain multiple portions from the same namespace package. You'd need a new path hook or mods to zipimport, but it's conceivable. Eric.