Can I add variables to watch list?

512 views
Skip to first unread message

Lei Shi

unread,
Feb 3, 2016, 11:42:12 AM2/3/16
to spyder
Hi,

I have been using Spyder's debugging tool for several times. I was wondering if there is a way to add some expressions (valid for current scope) to the default variable viewer, I would like to watch their values along the way. Now I have to type print statement in pdb console every time, it became too much trouble when I am going through a long loop... 

I searched online for answers, and I found some discussion about viewing user defined type variables, and similar things. But I didn't find a specific answer for what I was looking for. Could someone help me?

Thanks!
Lei

Yuxiang Wang

unread,
Feb 4, 2016, 8:08:09 AM2/4/16
to spyder
Have you checked the variable explorer (by default it should be by the tab of object inspector)? It will display all variable values including the current scope when you debug and watch. For example:

def func():
    for i in range(100):
        j = i

func()

You can set a breakpoint at j = i and see in the variable explorer that both i and j are incrementing.

Shawn
Reply all
Reply to author
Forward
0 new messages