[Python-Dev] a strange case

Walter Dörwald walter@livinglogic.de
Tue, 20 May 2003 13:51:16 +0200


Guido van Rossum wrote:
>>But reload() won't work for these pseudo modules (See
>>http://www.python.org/sf/701743).
> 
> Reload() is a hack that doesn't really work except in the most simple
> cases.  This isn't one of those.

It could be made to work, if the code in a module had a way of
knowing whether this import is the first one or not, and it had
access to what was in sys.modules before the import mechanism
replaces it with an empty module.

>>What about the imp module?
 >
> Yes, what about it?  (I don't understand the remark.)

Does the imp module work with modules that replace the
module entry in sys.modules? (Code in PyImport_ExecCodeModuleEx()
seems to indicate that it does.)

Bye,
    Walter Dörwald