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 terry.reedy
Recipients gregorlingl, terry.reedy
Date 2014-07-23.19:57:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406145466.97.0.661318262793.issue22051@psf.upfronthosting.co.za>
In-reply-to
Content
I propose to remove the following two lines with 'reload' from turtledemo.__main__.py.

from importlib import reload
...
... def loadfile(self, filename):
...
        reload(self.module)

Reloading modules each time a demo is run allows and even encourages module level code that initializes variables (other than classes) and has system side-effects. In particular, some such calls created the test problems reported in #21882. Code that needs to be run each time the required main() is called should be inside main.  Indeed, reforming the two_canvases demo (see patch for #21882) made two_canvases work properly within the demo driver.

With the demos patched, I tried them all twice after commenting out the reload. I did not notice any difference, except possibly faster response.

I already edited the help text to tell users to initialize in main().
History
Date User Action Args
2014-07-23 19:57:47terry.reedysetrecipients: + terry.reedy, gregorlingl
2014-07-23 19:57:46terry.reedysetmessageid: <1406145466.97.0.661318262793.issue22051@psf.upfronthosting.co.za>
2014-07-23 19:57:46terry.reedylinkissue22051 messages
2014-07-23 19:57:46terry.reedycreate