class fileInfo(dict):
def __init__(self, name, typ, size = 1):
self = {}
self["name"] = name
self["type"] = typ
self["size"] = size
def __getitem__(self, key):
if key == "name":
return dict.__getitem__(self, "name")+ "." + dict.__getitem__(self, "type")
return dict.__getitem__(self, key)
I have created this class, but I have problems with the init function. When I try to initialize an object of this class, the init function returns me an empty dictionary.
What am I not understanding as far as the initialization function is concerned?