Brett Cannon added the comment:

The error from using -m stems from runpy not aliasing the module as both 
"__main__" and "reloader". I suspect the reason is that having a module under 
two names gets really messy because if you update just one of those modules you 
leave the  other one around and then you have skewed the results.

As for your use-case, be aware that importlib.reload() is not designed for it. 
You will still have objects floating around in the interpreter that are using 
the original module and so you're not going to get all instances of objects 
automatically updated to the new code. The only way to guarantee usage of the 
new code is to restart the interpreter.

I get why you want this, John, but Python is simply not structured to support 
what you're after. Closing as "won't fix".

----------
nosy: +ncoghlan
resolution:  -> wont fix
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29206>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to