pycharm如果父类具有描述符__get__返回值是self,则对子类参数没有自动完成建议

时间:2019-05-28 16:34:37

标签: python pycharm

如果父类具有描述符 get 的返回值是self,则子类(继承)没有自动完成选项。

这是示例。

class A:
    __metaclass__ = ABCMeta

    parameter1 = None
    def __get__(self, instance, owner):
        # do some stuffs here
        return self

class B(A):
    pass

class C(B):
    parameter2 = None

class MainCode():
    c = C()

    def calling_c(self):
        self.c.pa
# waiting for the dropdown parameter1 and parameter2. 
# but it ONLY suggest parameter1. parameter2 is not read by the pycharm. 
#removing the descriptor __get__ is the only way to get both param1 and param2 suggestion. 
# main function[enter image description here][1]

0 个答案:

没有答案