Reputation: 33
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)
?
Upvotes: 3
Views: 1372
Reputation: 1531
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.
Upvotes: 2
Reputation: 81654
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.
Upvotes: 3