No specific reason. Feel free to file a bug and assign it to me.<br><br><div class="gmail_quote">On Wed, Jul 20, 2011 at 14:15, P.J. Eby <span dir="ltr"><<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">At 01:08 PM 7/20/2011 -0700, Brett Cannon wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Obviously feel free to ask me questions (publicly or privately) if anything in the importlib code is an issue for you (I know its structure for bootstrapping reasons is a bit odd).<br>
</blockquote>
<br></div>
While we're on the topic, I was just browsing through importlib (while doing my sketch on how to support the "no pure virtual imports" change to PEP 402; see <a href="http://mail.python.org/pipermail/python-dev/2011-July/112385.html" target="_blank">http://mail.python.org/<u></u>pipermail/python-dev/2011-<u></u>July/112385.html</a> ) and I noticed that there are a few places in the implementation where it makes assumptions about objects' boolean values.<br>
<br>
For example, PathFinder's find_module treats an empty path the same as sys.path, and will also fail if for some reason the bool() of a PEP 302 finder or loader object is False. Also, module_for_loader() will create a new module object, if you have a False module subclass in sys.modules.<br>
<br>
Is there any particular reason for these digressions from strict PEP 302? I can understand, say, Jython and IronPython not wanting to generate object id's, but I was under the impression that those languages can do identity checks (especially against None) without running into the general problem of generating object IDs in the presence of garbage collection.<br>
<br>
These distinctions could be more problematic than they appear, as it's possible to inadvertently make your loader or your module subclass capable of being False (for example, if you subclassed a sequence type or implemented a __len__), and this could lead to some very subtle bugs, albeit very rare ones as well. ;-)<br>
<br>
</blockquote></div><br>