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/2009-January/084937.html below:

[Python-Dev] Is raising SystemError during relative import the best solution?

[Python-Dev] Is raising SystemError during relative import the best solution? [Python-Dev] Is raising SystemError during relative import the best solution?Brett Cannon brett at python.org
Thu Jan 8 21:03:10 CET 2009
On Thu, Jan 8, 2009 at 11:33, Guido van Rossum <guido at python.org> wrote:
> On Thu, Jan 8, 2009 at 11:25 AM, Brett Cannon <brett at python.org> wrote:
>> So it turns out that if you try to do a relative import where a parent
>> is not loaded, it raises a SystemError. This has been in there since
>> Guido added package support back in the day. But this seems more like
>> an ImportError than a SystemError to me. My guess is that the original
>> purpose was to signify someone specified some relative import name
>> without the proper stuff to make the name resolve to what it should
>> be. But that to me is still an ImportError as the name came out wrong,
>> not that the system did something incorrectly.
>>
>> So I would like to propose to remove the SystemError and make it an
>> ImportError. Anyone object?
>
> Hm. The SystemError is because this is a logical impossibility -- how
> could you be doing an import (relative or otherwise) from P.M when P
> is not loaded? It could only happen if somebody has been removing
> stuff selectively from sys.modules. Why don't you want this to be a
> SystemError?
>

Doesn't fit my mental model as nicely as raising ImportError. And as
an aside this also makes testing a little bit more of a pain, but that
is not the reason I brought this up. But the way you phrased it makes
sense for me not to care enough to press this any farther.

-Brett
More information about the Python-Dev mailing list

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