Marc-Andre Lemburg <m...@egenix.com> added the comment: Brett Cannon wrote: > > Brett Cannon <br...@python.org> added the comment: > > I don't quite follow what you are suggesting, MAL. Are you saying to freeze > importlib.__init__ and importlib._bootstrap and somehow have > improtlib.__init__ choose what to load, frozen or source?
No, it always loads and runs the frozen code, but at the start of the module code it branches between the frozen bytecode and the code read from an external file. Pseudo-code in every module you wish to be able to host externally: # # MyModule # if operating_in_dev_mode and '<frozen>' in __file__: exec(open('dev-area/MyModule.py', 'r).read(), globals(), globals()) else: # Normal module code class MyClass: ... # hundreds of lines of code... Aside: With a module scope "break", the code would look more elegant: # # MyModule # if operating_in_dev_mode and '<frozen>' in __file__: exec(open('dev-area/MyModule.py', 'r).read(), globals(), globals()) break # Normal module code class MyClass: ... # hundreds of lines of code... ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14657> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com