python - Where are key/value pairs for an object stored for a Built-in Class? -
where key/value data stored builtin class? not accessible "__dict__" because not considered attributes.
example:
class testnewclass(dict): def __init__(self, a, b, c): self.a = self.b = b self["item"] = c x = testnewclass(3, 4, 5) print(x.a) # 3 print(x.b) # 4 print(x["item"]) # 5 print(x.__dict__) # {"a": 3, "b": 4} c not considered attribute
Comments
Post a Comment