Bug in object display in debugger?
class TMerge:
def __init__(self, t1, t2):
self.t1 = t1
self.t2 = t2
def __call__(self, object):
return self.t1
tm1 = TMerge(3, lambda x: x + 2)
tm2 = TMerge(lambda x: x + 5, 6)
x = 1
Make a breakpoint on the "tm1" line, step through. Notice that tm1 is shown with a single instance variable (t1), and tm2 is shown with a single instance variable (t2). The debugger seems to be confused because of the __call__ method, and refuses to show the instance variable with the lambda value.
I just spent an hour wondering what I was doing wrong!
def __init__(self, t1, t2):
self.t1 = t1
self.t2 = t2
def __call__(self, object):
return self.t1
tm1 = TMerge(3, lambda x: x + 2)
tm2 = TMerge(lambda x: x + 5, 6)
x = 1
Make a breakpoint on the "tm1" line, step through. Notice that tm1 is shown with a single instance variable (t1), and tm2 is shown with a single instance variable (t2). The debugger seems to be confused because of the __call__ method, and refuses to show the instance variable with the lambda value.
I just spent an hour wondering what I was doing wrong!
Please sign in to leave a comment.
Thanks!
Sorry for delayed response.
That is definitely a bug. I've created an issue http://youtrack.jetbrains.com/issue/PY-8138
I've looked at this more closely and can say that this is not a bug indeed. PyCharm debugger filters out all function fields from variables. To watch detailed object content I recommend using debug console where you can execute any commands like dir(tm1) while you are standing at a breakpoint.
Please re-consider this issue. When I look at any object in the debugger, I expect to see every field I have defined on that object.
If I use any Python object with a field containing a lambda value, that field totally disappears in the Pycharm debugger. This makes Pycharm debugger most confusing for code that passes around functions, i.e. for any kind of functional programming. I understand you may not want to show all instance methods, but Python has plenty of ways to distinguish bound method, unbound method, and function-lambdas.
Please, is there any plan to fix this? Our project uses this style quite heavily.
This is still an issue and highly frustrating if you're unaware of this fact. Please JetBrains could you please reconsider and add this feature to the debugger?
PyCharm is a great product. Please make it even more great.
Kind regards.
Erik
I think I'm running into a similar problem as the folks above. I'm debugging objects and wondering what methods they contain. For an hour or so I was very confused how methods were being called that didn't appear in the debugger, before finally realizing the debugger doesn't show bound methods. Can a feature be added to the debugger that shows bound methods? This would be equivalent to inspect.getmembers which lists all the methods.
For reference I am using Pycharm 2016.3.2 Community Edition on Arch
Same issue. Why not make it an option on the settings cog? (even if disabled by default)