[ZODB-Dev] Reloading product in 2.8

Jim Fulton jim at zope.com
Fri Jul 15 06:54:59 EDT 2005


Shane Hathaway wrote:
> Jim Fulton wrote:
> 
>>It also doesn't handle global data properly.
>>
>>It tries to do something that Python modules were never
>>designed to support, which is to load them more than once.
> 
> 
> However, given the existence of the reload() builtin, someone apparently
> believed Python modules *were* designed to support reloading.  Because
> reload() is a builtin, Python seems to promise that reload() is
> reliable, but in fact it's rarely reliable.  There would be a lot less
> confusion if reload() were moved somewhere like the "imp" module.

Yup.

>>When it fails, it does so in subtle ways that cause people
>>to lose lots of time.
> 
> 
> I agree.  The right way to refresh is to detect code changes (ideally
> using Linux's brand new inotify mechanism, or something similar when
> inotify is not available), display a "please wait" message to the user,
> and restart the process.

Doing so automatically could still be a problem.  If you are developing
you don't want the prpcess to restart automatically because a file
changed.  The change could be incomplete or the process could have
precious non-persistent state.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list