Hi all,
We just hit functions, and I assigned my students to write ten short functions to do things like convert Fahr. to Cels., etc.
My "brilliant" :rolleyes: plan was to create a test suite and have them import their file and run the tests. Because the filename wasn't absolutely specified, they had to modify this line: from my_asn import *
and then the test suite would run the appropriate functions, spit out the results, and all would be sweetness and light.
Problem: naturally, some of the test results will fail and students will need to modify their code. BUT, when the line "from my_asn import *" is re-executed, the namespace already has all of the functions in it, so the module isn't reloaded.
Solution: Python has a builtin reload() function to reload modules.
Problem with the Solution: reload() can only work with imports in the form import my_file
NOT from my_file import *
:mad:
Partial workaround: IF the students start by rightclicking the test suite file, hitting "edit with IDLE", and then running it, they get the problem above. But IF the students start by running IDLE, then opening the test suite file, then running it, then IDLE kindly restarts the shell each time and accordingly reloads the module.
Question: Why does IDLE seem to have two different modes: one with a "Shell" menu and that restarts the shell every time a program is run, and one without and that doesn't?
Grr...
Jeff