5 def __init__(self, hist_file, *args, **kwargs):
6 if os.path.isfile(hist_file):
7 f = open(hist_file, 'r')
8 h = map(lambda x: x.strip(), f.readlines())
10 self._file = open(hist_file, 'a')
12 self._file = open(hist_file, 'w')
15 list.__init__(self, h, *args, **kwargs)
17 def __add__(self, item):
19 super(History, self).__add__(item)
20 self._file.writelines(map(lambda x: x + '\n', self))
23 def insert(self, index, item):
25 super(History, self).insert(index, item)
26 self._file.writelines(map(lambda x: x + '\n', self))
29 def __delitem__(self, item):
30 super(History, self).__deltitem(item)
31 self._file.writelines(map(lambda x: x + '\n', self))