Disabling Cache?

Glyph Lefkowitz glyph at twistedmatrix.com
Fri Aug 17 16:06:29 EDT 2001


On Fri, 17 Aug 2001, Alex Martelli wrote:

> "Angel Asencio" <asencio at mitre.org> wrote in message
> news:3B7D2983.77C3CBE3 at mitre.org...
> > Greetings:
> >   I know that I can do "reload" to load a module all over again.  But I do not want to trace all the modules
> > to determine which ones are dependent and reload them.
> 
> You don't have to reload any other module, as long as you don't use
> the statement 'from x import y' (or otherwise stash attributes of
> module x away somewhere), in which case the only real solution
> is to stop doing so -=- use 'import x' and always refer to x's attributes
> as x.pleep, x.kloop, etc, explicitly, and you'll have no problem.

Or, you can use twisted.python.rebuild from the Twisted suite
(www.twistedmatrix.com) rather than standard reload, and all of the
problems that alex mentioned will be taken care of for you, including
refreshing existing instances!  I believe there are still a few conditions
it doesn't handle; but they're highly obscure (I haven't run into any real
code which doesn't work with it yet.) Provided that you're using a version
of Python where __class__ is assignable, you should be fine! <0.5 wink>

Patching IDLE to use this should be trivial.

                      ______      __   __  _____  _     _
                     |  ____ |      \_/   |_____] |_____|
                     |_____| |_____  |    |       |     |
                     @ t w i s t e d m a t r i x  . c o m
                     http://twistedmatrix.com/users/glyph






More information about the Python-list mailing list