A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-July/046480.html below:

[Python-Dev] Fix import errors to have data

[Python-Dev] Fix import errors to have dataWalter Dörwald walter at livinglogic.de
Wed Jul 28 10:29:00 CEST 2004
Delaney, Timothy C (Timothy) wrote:
> Tim Peters wrote:
> 
> 
>>[Delaney, Timothy C (Timothy)]
>>
>>>OK - the problem as I see it is that a given module that exists, but
>>>raises ImportError, only raises ImportError *once*, whereas it really
>>>should raise ImportError every time
>>
>>Jim's after something different, while the problem you're thinking
>>about is more general than just ImportError.  When an import of an
>>existing module fails for *any* reason, subsequent attempts to import
>>the same module succeed.  For example,
> 
> Good point. This is the same as not wanting modules in an insane state
> in sys.modules.

This simplest solution for this problem would be to put the module
in sys.modules only after executing the module's code finishes.
Unfortunately this breaks circular imports, because it would lead
to infinite recursion.

This looks like we can't have both: Having a module available only
after importing it works and having circular imports where one
module uses another module that is only half initialized.

Bye,
    Walter Dörwald

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