<br><br><div class="gmail_quote">On Wed, May 2, 2012 at 2:32 PM, "Martin v. Löwis" <span dir="ltr"><<a href="mailto:martin@v.loewis.de" target="_blank">martin@v.loewis.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 02.05.2012 12:23, Eric V. Smith wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 5/2/2012 3:17 AM, "Martin v. Löwis" wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
About the only question I have is: Is everyone okay with the changes to<br>
the finders, described in the PEP?<br>
</blockquote>
<br>
It looks good to me. It's a somewhat surprising change, but I can see no<br>
flaw in it.<br>
</blockquote>
<br>
Surprising in that any change to find_module is needed, or surprising<br>
that it now returns one of {None, loader, str}?<br>
<br>
</blockquote>
<br></div>
Both, actually. I had expected that new API (i.e. a new method of some kind) would be necessary, so it has elegance that this is not required.<br>
OTOH, explicit type checking is despised in the OO world, and varying<br>
result types are disliked by Guido van Rossum (not sure whether this<br>
reservation applies to this case as well, or only to cases where the<br>
return type depends on the parameter types).<br></blockquote><div><br></div><div>You actually don't need to explicitly type-check and instead can rely on duck typing::</div><div><br></div><div> if loader is None: continue</div>
<div> elif hasattr(loader, 'load_module'): return loader</div><div> else:</div><div> namespace.append(loader)</div><div> continue</div><div><br></div></div>