Pycharm Python console: What is "Variables Loading Policy"?

Viewed 406

What is the Variables Loading Policy in Pycharm Python Console AND WHY would I want to use it? I've looked up the doc'n here: Pycharm Variable Loading Policy

and I'm still just as confused as ever. What is the context that "Variable Loading Policy" is in? Policy for what? Which variables?? It's not clear what it means to "load a variable". Yes, I know the diff b/tw synch/asynch. But variables in the script that the console runs get "loaded" regardless of "policy". Why do I care how they get loaded?

enter image description here

2 Answers

Console has a variable view where variable/value pairs are displayed. Imagine a class implementing __str__ and the method either takes quite a lot of time or even trigger an exception. If PyCharm tries to load the instance string representation in this case you will either got stuck while it is calculated or will receive an error. That's why this option was introduced.

E.g. switching to "On demand" variable loading policy with prevent PyCharm to auto-load variable values

enter image description here

From Pycharm Support:

When you debug your code in PyCharm, you can preview the variable values.

"Examine/update variables"

Loading policies define the way these variables are loaded during the debugging process. By default, variables are loaded asynchronously. However, in some cases, you don't need to wait for some big data collections, then you can choose the "On Demand" option.

-A.R. PyCharm Web Help

Related