Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)