Deprecating reload() ???

John Roth newsgroups at jhrothjr.com
Thu Mar 11 16:43:14 EST 2004


"Ellinghaus, Lance" <lance.ellinghaus at eds.com> wrote in message
news:mailman.282.1079035927.19534.python-list at python.org...
> > > Other surprises:  Deprecating reload()
>
> >Reload doesn't work the way most people think
> >it does: if you've got any references to the old module,
> >they stay around. They aren't replaced.
>
> >It was a good idea, but the implementation simply
> >doesn't do what the idea promises.
>
> I agree that it does not really work as most people think it does, but how
> would you perform the same task as reload() without the reload()?
>
> Would this be done by "del sys.modules['modulename']" and then perform an
> 'import'?
>
> I use reload() for many purposes, knowing how it works/does not work.

I usually figure out another way to do it - mostly reload the entire
program from scratch. In any case, it's not a real issue for me -
it's just enough of an irritation that the PythonWin editor does it that
I keep a command line open rather than use what is (to me) a
really broken implementation of run.

There are a lot of things in life that I wished worked the way they
are advertised. They don't, so you cope.

John Roth
>
> Lance Ellinghaus
>





More information about the Python-list mailing list