-3

I used to code in Matlab in which it's easy to see the saved variables in the workspace window. So for example a = [1,2,3] can be easily found in the workspace window.

Now I started to use python in Pycharm. In Python I can create the same variable, a = [1,2,3] but there isn't a window which shows me all the variables already created in the script. Having only 1 variable isn't a problem but when defining a lot of variables it can be difficult to know which variables are already defined ant what these variables contain.

My Question:

How does one have a good overview of all variables in Python (Pycharm)? Is there a similar window like the Workspace window of Matlab in Pycharm?

Oamriotn
  • 257
  • 1
  • 3
  • 8
  • You might just have to print all the values out. – rohanharrison Jan 24 '17 at 20:10
  • Duplicate question: http://stackoverflow.com/questions/633127/viewing-all-defined-variables – Martin Krämer Jan 24 '17 at 20:13
  • I query your approach. Python encourages you to code using relatively small functions, each with its own local namespace. They are collected into modules, again with their own namespaces. So an "overview of variables" is not useful, since variable names are not shared. If you find you are using global variables all over the place then you should reconsider your design. – cdarke Jan 24 '17 at 20:18
  • @cdarke what he's asking has nothing to do with global variables. [MATLAB's workspace browser](https://www.mathworks.com/help/matlab/ref/workspace.html) shows the contents of the current workspace. MATLAB's scripts and command window both execute in the base workspace so you can see what's happening as you enter commands. Python IDEs like Spyder and Canopy have similar interfaces. The analog in PyCharm is the [variable viewer](https://www.jetbrains.com/help/pycharm/2016.3/debug-tool-window-variables.html) in the debug tool, but that's limited to debugging. – sco1 Jan 24 '17 at 20:36
  • Why do you have to use pycharm? Different IDEs have different focuses. An IDE like spyder is more oriented towards the sort of interactive use you are doing and has a variable list. – TheBlackCat Jan 25 '17 at 17:42

1 Answers1

1

You can use the Debug Tool Window to examine the variables stored in your application.

More information can be found here: (PyCharm 2016.3) https://www.jetbrains.com/help/pycharm/2016.3/debug-tool-window-variables.html

mmenschig
  • 1,088
  • 14
  • 22
  • 1
    Of note, you may need to set a break point to stop at the area of interest to inspect your current variable set. – tabbek Jan 24 '17 at 20:21