Pyharm's visual warning of an unresolved attribute reference

I have two classes that look like this:

class BaseClass(object):

    def the_dct(self):
        return self.THE_DCT


class Kid(BaseClass):

    THE_DCT = {'vars': 'values'}


# Code i ll be running
inst = Kid()
print(inst.the_dct)

Inheritance should be like this; a second class containing THE_DCTand a first class containing def the_dct.

This works fine, but my problem is that I get a warning in Pycharm (unresolved attribute reference), near THE_DCTat BaseClass.

  • Is there a reason why this warns me (as in why should I avoid this)?
  • Is there something I have to do differently?
+4
source share
1 answer

BaseClass self.THE_DCT, PyCharm , , THE_DCT .

, , PyCharm , . , , - , , , .

( , BaseClass), :

class BaseClass(object):
    THE_DCT = {}

    def the_dct(self):
        return self.THE_DCT
+9

All Articles