[Python-ideas] Stack traces ought to flag when a module has been changed on disk

Jonathan Fine jfine2358 at gmail.com
Wed Jan 30 12:35:40 EST 2019


> I think using reload should raise warnings, since it doesn't work, and the
> reload case shouldn't be the killer of this really good idea.

In Python2, reload is in __builtin__ module (and so available without
import at the Python console).

Since Python 3.4 this functionality is in the importlib module.
https://docs.python.org/3.7/library/importlib.html#importlib.reload

reload is a 44 line pure Python function. No need to use it if you
don't want to.
https://github.com/python/cpython/blob/3.7/Lib/importlib/__init__.py#L133-L176

I was writing this as Michael Foord's similar (but concise) post came in.
-- 
Jonathan


More information about the Python-ideas mailing list