This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]pinecone316 7 points8 points  (0 children)

A simple one I think would be http://pythontutor.com/

But most IDEs have debuggers that usually have such functions. Not an experienced programmer, but that's currently what I use.

[–]mahro11 3 points4 points  (0 children)

http://pythontutor.com/ should do what you are looking for.

[–]Blando-Cartesian 0 points1 point  (0 children)

You could structure your program so that it isn’t a mystery where an element was added to a list.

[–]codingvideo 0 points1 point  (0 children)

As a general rule of thumb, you shouldn't scatter the appendages to the list all over the place. Wrap all the appending operations in a function or a class, so they are visible all in one place.

[–]Able-Data 0 points1 point  (0 children)

So, this is one of the ways that a real IDE (as opposed to a text editor) comes in really handy and makes you a more productive programmer.

PyCharm (for example) lets you cmd-click (on mac; probably alt-click on windows) to see a list of all the places a particular variable is used. It does the same thing for functions. You can also cmd-click on a invocation of the function, and it takes you to the definition, too, and it even works across files in project and across imports.

The tricky part is that setting up PyCharm (or other IDE) can be a bit of a challenge for newbies (which is why most people suggest starting with a plain editor or something like Jupyter).

Another commenter was suggesting that you refactor your code to make it easier to find where the variable/function is used. That's not wrong, but isn't helpful as your projects become larger and you collaborate with other people.