I encountered a behaviour yesterday which I found unusual and couldn't explain. It would be great to understand it and know if it's a feature or a bug.
As far as I can see, it demonstrates a huge difference in the default behaviour (and possibly garbage collection) of interpreted code statements at the 'top-level' of a module's scope versus the behaviour of exactly the same code inside a function definition.
I found that running statements directly in the console, equivalent to executing them in module scope, was fully functional. However, placing exactly the same code in a function scope then running the function was not fully-functional. The way to restore functionality was to introduce an explicit garbage collection step in the function definition which seemed not to be needed when running the same statements from the console.
This demonstrates the weird behaviour...
https://photos.app.goo.gl/dZarHkhYgv2MRD513
This is the code I was using...
https://github.com/cefn/retrotextual/bl ... tlights.py
Basically if the steps in primaryRegime() are pasted directly, they run, but when placed inside primaryRegime() they fail.