[Python-Dev] Fix import errors to have data (original) (raw)
Delaney, Timothy C (Timothy) tdelaney at avaya.com
Wed Jul 28 04:57:30 CEST 2004
- Previous message: [Python-Dev] Re: Rationale behind removing kwdict from keyword.py?
- Next message: [Python-Dev] Fix import errors to have data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
I've just gone back over Jim's original email, and it is a different case being talked about there - specifically, determining if an ImportError was thrown by the module that was specifically being imported, rather than something it imports.
However, I don't see the utility of that. I definitely can't think of a use case for it.
OTOH, ensuring that if any exception is thrown when importing a module, it will not appear in sys.modules (and the exception is raised each time you try to import) is IMO a very useful property, and I think would solve what I think is Jim's issue at the root.
Tim Delaney
- Previous message: [Python-Dev] Re: Rationale behind removing kwdict from keyword.py?
- Next message: [Python-Dev] Fix import errors to have data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]