Pycharm suggesting wrong fields on autocomplete

I have code looking like this:

obj = ClassA()
//obj. => field from ClassB (field_b1) is suggested
obj = ClassB()
obj.field_b1 = 1

When I type obj. after creating an object of ClassA, Pycharm suggests fields that are in ClassA and fields that are in ClassB and used in the code afterwards as obj.field.

If I remove the line:

obj.field_b1 = 1

Pycharm suggests the correct fields. So seems like it looks forward in the code to see how obj was used.

How can I disable that?

 

0

Hmm, doesn't seem to be a way to disable that behavior. PyCharm seems to be clueless about re-usages of variables for cases like this, so I guess you can report this as bug to https://youtrack.jetbrains.com/issues

0

请先登录再写评论。