Skip to content Skip to sidebar Skip to footer

Strange Module Reload Behavior In Spyder Or IPython

I have an issue re-running a script in spyder, which dynamically tabulates some of its own attributes. Here is a minimal example that is representative of what I am doing. I have a

Solution 1:

This is a feature in Spyder that is built on purpose to allow you to continue running from stop points, especially when considering longer run times to generate specific results, and also powers the variable explorer function.

There is a way around it though following the instructions in this answer to Clear all variables before each run or by restarting.

However, as pointed out by roganjosh, clearing the namespace is not necessarily better.

You can run a function that takes 10 mins to process data and return it to a global name, then just hash that function call out for every subsequent run and never have to incur the processing time again (until you wipe the namespace, that is).

If you want to only reset one or a group of variables, you can use reset_selective

%reset_selective [-f] regex

Post a Comment for "Strange Module Reload Behavior In Spyder Or IPython"