Comparing PythonWin and IDLE?

Michael Scharf Michael.Scharf at
Fri Apr 14 15:43:33 EDT 2000

Charlie Derr wrote:
>         instead of:
> import myModule
>         try this:
> reload(myModule)
>         and you should be able to get your recently modified changes to take effect
> without restarting python

Well, not quite:

if you wrire (in another module)

  from myModule import MyFunction,MyClass

reload will *not* change the function nor the myinstance.
If you would write:

  import myModule

the new version of MyFunction an MyClass will be called, but
existing instances of MyClass will not be changed to the new version.
Also the old version of my_callback would be called.

I know it is possible to change the code of existing functions.
So, with some ticks it should be possible to replace the code
of existing functions. The same must be done for all mutable objects
(list, dicts etc.). Only not mutable direct imported variable (int,
string, tuple etc.) cannot be changed that way.

I just wonder if anybody has written such a clever reimport...

     ''''\     Michael Scharf
    ` c-@@     TakeFive Software GmbH, a Wind River Company
    `    >
     \_ V      mailto:Michael.Scharf at

More information about the Python-list mailing list