本文整理汇总了Python中pypy.interpreter.baseobjspace.ObjSpace.finditem方法的典型用法代码示例。如果您正苦于以下问题:Python ObjSpace.finditem方法的具体用法?Python ObjSpace.finditem怎么用?Python ObjSpace.finditem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.interpreter.baseobjspace.ObjSpace
的用法示例。
在下文中一共展示了ObjSpace.finditem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finditem
# 需要导入模块: from pypy.interpreter.baseobjspace import ObjSpace [as 别名]
# 或者: from pypy.interpreter.baseobjspace.ObjSpace import finditem [as 别名]
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: finditem
# 需要导入模块: from pypy.interpreter.baseobjspace import ObjSpace [as 别名]
# 或者: from pypy.interpreter.baseobjspace.ObjSpace import finditem [as 别名]
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)
示例3: finditem
# 需要导入模块: from pypy.interpreter.baseobjspace import ObjSpace [as 别名]
# 或者: from pypy.interpreter.baseobjspace.ObjSpace import finditem [as 别名]
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)