osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pre-edit stuff persists in a reloaded a module


On 10/5/2019 10:24 AM, Friedrich Rentsch wrote:

> Thank you, Peter. I guess, then, that not only 'inspect', but the 
> compiler as well reads source off the line cache and clearing the latter 
> would make 'reload' work as expected. Are there other snags lurking, 
> that you advise against using 'reload'?

Existing references to objects may continue to refer to old versions 
after loading new definitions. I never use reload.

> What are the alternatives for 
> developing iteratively, alternating between running and editing?

IDLE used properly is great for this.  Edit and hit F5 to save and run.

I personally recommend changing the Option Settings General tab 'At 
Start of Run (F5)' to (*) No Prompt.  Note that if you get an exception 
(in the Shell), right click on appropriate line of the traceback and 
click 'Goto File/line' to go to the line in the editor.

And IDLE (and Python) for 3.7+ has multiple improvements over IDLE for 
2.7, so unless you need to specifically edit 2.7 code, do upgrade.

-- 
Terry Jan Reedy