A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20060421/3e3f1a1a/attachment.htm below:

<br><div><span class="gmail_quote">On 4/21/06, <b class="gmail_sendername">guido.van.rossum</b> &lt;<a href="mailto:python-3000-checkins@python.org">python-3000-checkins@python.org</a>&gt; wrote:</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The hardest part was fixing two mutual recursive imports;<br>somehow changing &quot;import foo&quot; into &quot;from . import foo&quot; where<br>foo and bar import each other AND both are imported from __init__.py caused things to break.&nbsp;&nbsp;Bah.
</blockquote><div><br>Hm, this is possibly a flaw in the explicit relative import mechanism. Normal circular imports work because a module object is stuffed into sys.modules before any code for the module is executed, so the next 'import' of that module just finds the half-loaded module object. I guess 'from . import name' really looks at the package contents, though, and there, the module isn't stored until it's done loading. I'm not sure why it raises a 'cannot import name' exception instead of recursing into a spiral of death, but I guess that's a good thing. :)
<br><br>Should this be fixed, or is it an esoteric enough case that I shouldn't bother?<br><br></div></div>-- <br>Thomas Wouters &lt;<a href="mailto:thomas@python.org">thomas@python.org</a>&gt;<br><br>Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4