Object inspections in Python 3.4 IDLE debugger on Windows
Asked Answered
L

1

6

I am new to Python. I am using the Python IDLE Debugger on Windows. Is there a way to inspect object attributes in the debugger? The debugger only shows object address/type.

A solution I tried was to create global variables and assign object attributes to them. The debugger then shows global variables. This works for mutable types such as list, but for immutable type such as int, it shows the value at assignment only. Is there a way to bind a global name to a global object's int attribute?

Lefthanded answered 16/10, 2014 at 21:22 Comment(5)
You could try print statements for simple casesRhaetic
@Lefthanded maybe look at alternative IDE's. I use WingIDE and its debugger let you inspect attributes, used/tried other IDE's in the past and they allowed that too. Or maybe use PDB the Python debugger if you don't want to go with another IDE.Perceptive
Thanks guys. Print for debugging - I use that a lot, but was looking for something more efficient. I'll check out WingIDE. Is there a way to bind a global name to an object's immutable attributes?Lefthanded
You can bind any name to any accessible object. However, the new binding is independent of previous objects. If you bind a name a to an object o that is an attribute x of object b and you rebind b.x to object p, a remains bound to o and does not track b.x. Adding an new feature to Debugger to display attributes should be possible. I will conisder it.Colony
In the meanwhile, after a program run from the editor stops, obj, dir(obj) at the Shell prompt displays an object's ending type and dictionary. Inside code, print(obj, dir(obj)) does the same.Colony
L
4

To close the loop on this, based on responses received:

  • IDLE debugger does not support object inspection in the pop-up window
  • Thanks Terry Jan Reedy for putting it on list for future potential improvements. The IDLE is a big help to new Python programmers
Lefthanded answered 28/10, 2014 at 1:49 Comment(1)
If you accept you own answer, this will no longer show up on 'unanswered questions'.Colony

© 2022 - 2024 — McMap. All rights reserved.