How to load new class definitions at runtime?

Dave Brueck dave at
Thu Nov 11 22:52:10 CET 2004

Dave Brueck wrote:
> 1) No module level code. Modules can have optional Setup() and 
> Teardown() functions that get called if present (the most typical use 
> case is to pass state from the old version of the module to the new 
> version - the return value from Teardown gets passed to the new module's 
> Setup function).

A slight clarification: at the module level we allowed imports and definition of 
module global variables of course, just not code that had external side effects. 
So e.g. if a module always had its own worker thread running, it would get 
started in the Setup method and stopped in Teardown.


More information about the Python-list mailing list