Пример #1
0
 def __getitem__(self, key):
     if key not in self.keys():
         val = self.__class__()
         self.__setitem__(key, val)
     else:
         val = dict.__getitem__(self, key)
     return val
Пример #2
0
 def __getitem__(self, key):
     if key not in self.keys():
         val = self.__class__()
         self.__setitem__(key, val)
     else:
         val = dict.__getitem__(self, key)
     return val
Пример #3
0
 def __getitem__(self, idx):
     try:
         return dict.__getitem__(self, idx)
     except KeyError:
         return 0
Пример #4
0
 def __getitem__(self, idx):
     try:
         return dict.__getitem__(self, idx)
     except KeyError:
         return 0