homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients Arfrever, brett.cannon, eric.smith, eric.snow, lemburg, ncoghlan, pitrou
Date 2012年04月24日.19:51:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <4F970452.70305@egenix.com>
In-reply-to <1335295415.27.0.710009130636.issue14657@psf.upfronthosting.co.za>
Content
Brett Cannon wrote:
> 
> Brett Cannon <brett@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...
History
Date User Action Args
2012年04月24日 19:51:50lemburgsetrecipients: + lemburg, brett.cannon, ncoghlan, pitrou, eric.smith, Arfrever, eric.snow
2012年04月24日 19:51:49lemburglinkissue14657 messages
2012年04月24日 19:51:49lemburgcreate

AltStyle によって変換されたページ (->オリジナル) /