As far as I remember, in IntelliJ, the debug window has the option to view the toString()
of an object instead of its memory address. Is there a way to do this in PyCharm with an object's __str__(self)
?
Asked
Active
Viewed 961 times
3

felipsmartins
- 13,269
- 4
- 48
- 56

kgalford1
- 33
- 3
2 Answers
3
This should be done with __repr__
:
class Foo:
def __repr__(self):
return 'foo object'
f = Foo()
pass # breakpoint here
This shows 'foo object'
in the debugger's variables window.

DeepSpace
- 78,697
- 11
- 109
- 154
2
Pycharm in variable view / debugging is showing __str__
object representation instead of __repr__
.
Here was created a work-item on JetBrains website. Unforunetally I think there is still no progress.

Peter Trcka
- 1,279
- 1
- 16
- 21