0

I found this code in sqlmap project https://github.com/sqlmapproject/sqlmap/blob/master/lib/core/datatype.py .

I don't understand the meaning of calling the constructor AttribDict.__init__(self)

class InjectionDict(AttribDict):
    def __init__(self):
        AttribDict.__init__(self)

        self.place = None
        self.parameter = None
        self.ptype = None
        self.prefix = None
        self.suffix = None
        self.clause = None

        # data is a dict with various stype, each which is a dict with
        # all the information specific for that stype
        self.data = AttribDict()

        # conf is a dict which stores current snapshot of important
        # options used during detection
        self.conf = AttribDict()

        self.dbms = None
        self.dbms_version = None
        self.os = None
4

1 回答 1

1

该类InjectionDict是一个子类,它继承自的基类是AttribDict. 这就是这个语法的意思

class InjectionDict(AttribDict):

然后在InjectDict's__init__方法中,他们__init__首先调用基类的方法,然后再执行其余的子类特定__init__工作。

AttribDict.__init__(self)

有关此行为的用途的更详尽说明,请参阅这篇文章。

于 2014-08-23T15:28:03.933 回答