I would like to inherit the OrderedDict
class to set up a maximum length to the dict.
I did :
from collections import OrderedDict
class limitedDict(OrderedDict):
def __init__(self, length):
OrderedDict.__init__(self)
self.length = length
But now I don't see which function to overwrite to catch the "adding a key" event. I Googled for a while without finding the answer. Even special functions are not clearly an answer.