Пример #1
0
    def finditem(self, w_obj, w_key):
        """ Perform a getitem on w_obj with w_key (any object). Returns found
        element or None on element not found.

        performance shortcut to avoid creating the OperationError(KeyError).
        """
        if isinstance(w_obj, W_DictMultiObject) and not w_obj.user_overridden_class:
            return w_obj.getitem(w_key)
        return ObjSpace.finditem(self, w_obj, w_key)
Пример #2
0
    def finditem(self, w_obj, w_key):
        """ Perform a getitem on w_obj with w_key (any object). Returns found
        element or None on element not found.

        performance shortcut to avoid creating the OperationError(KeyError).
        """
        if (isinstance(w_obj, W_DictMultiObject)
                and not w_obj.user_overridden_class):
            return w_obj.getitem(w_key)
        return ObjSpace.finditem(self, w_obj, w_key)
Пример #3
0
 def finditem(self, w_obj, w_key):
     # performance shortcut to avoid creating the OperationError(KeyError)
     if type(w_obj) is self.DictObjectCls:
         return w_obj.get(w_key, None)
     return ObjSpace.finditem(self, w_obj, w_key)
Пример #4
0
 def finditem(self, w_obj, w_key):
     # performance shortcut to avoid creating the OperationError(KeyError)
     if (isinstance(w_obj, self.DictObjectCls)
             and not w_obj.user_overridden_class):
         return w_obj.getitem(w_key)
     return ObjSpace.finditem(self, w_obj, w_key)
Пример #5
0
 def finditem(self, w_obj, w_key):
     # performance shortcut to avoid creating the OperationError(KeyError)
     if (isinstance(w_obj, self.DictObjectCls) and
             not w_obj.user_overridden_class):
         return w_obj.getitem(w_key)
     return ObjSpace.finditem(self, w_obj, w_key)