本文整理汇总了Python中pypy.interpreter.baseobjspace.ObjSpace.getindex_w方法的典型用法代码示例。如果您正苦于以下问题:Python ObjSpace.getindex_w方法的具体用法?Python ObjSpace.getindex_w怎么用?Python ObjSpace.getindex_w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.interpreter.baseobjspace.ObjSpace
的用法示例。
在下文中一共展示了ObjSpace.getindex_w方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getindex_w
# 需要导入模块: from pypy.interpreter.baseobjspace import ObjSpace [as 别名]
# 或者: from pypy.interpreter.baseobjspace.ObjSpace import getindex_w [as 别名]
def getindex_w(self, w_obj, w_exception, objdescr=None):
# Performance shortcut for the common case of w_obj being an int.
# If withsmallint is disabled, we check for W_IntObject.
# If withsmallint is enabled, we only check for W_SmallIntObject - it's
# probably not useful to have a shortcut for W_IntObject at all then.
if self.config.objspace.std.withsmallint:
if type(w_obj) is W_SmallIntObject:
return w_obj.intval
else:
if type(w_obj) is W_IntObject:
return w_obj.intval
return ObjSpace.getindex_w(self, w_obj, w_exception, objdescr)
示例2: getindex_w
# 需要导入模块: from pypy.interpreter.baseobjspace import ObjSpace [as 别名]
# 或者: from pypy.interpreter.baseobjspace.ObjSpace import getindex_w [as 别名]
def getindex_w(self, w_obj, w_exception, objdescr=None):
if type(w_obj) is W_IntObject:
return w_obj.intval
return ObjSpace.getindex_w(self, w_obj, w_exception, objdescr)