当前位置: 首页>>代码示例>>Python>>正文


Python ObjSpace.unpackiterable_unroll方法代码示例

本文整理汇总了Python中pypy.interpreter.baseobjspace.ObjSpace.unpackiterable_unroll方法的典型用法代码示例。如果您正苦于以下问题:Python ObjSpace.unpackiterable_unroll方法的具体用法?Python ObjSpace.unpackiterable_unroll怎么用?Python ObjSpace.unpackiterable_unroll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.interpreter.baseobjspace.ObjSpace的用法示例。


在下文中一共展示了ObjSpace.unpackiterable_unroll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fixedview

# 需要导入模块: from pypy.interpreter.baseobjspace import ObjSpace [as 别名]
# 或者: from pypy.interpreter.baseobjspace.ObjSpace import unpackiterable_unroll [as 别名]
 def fixedview(self, w_obj, expected_length=-1, unroll=False):
     """ Fast paths
     """
     if isinstance(w_obj, W_TupleObject):
         t = w_obj.wrappeditems
     elif isinstance(w_obj, W_ListObject):
         t = w_obj.wrappeditems[:]
     else:
         if unroll:
             return make_sure_not_resized(ObjSpace.unpackiterable_unroll(
                 self, w_obj, expected_length)[:])
         else:
             return make_sure_not_resized(ObjSpace.unpackiterable(
                 self, w_obj, expected_length)[:])
     if expected_length != -1 and len(t) != expected_length:
         raise self._wrap_expected_length(expected_length, len(t))
     return make_sure_not_resized(t)
开发者ID:,项目名称:,代码行数:19,代码来源:

示例2: fixedview

# 需要导入模块: from pypy.interpreter.baseobjspace import ObjSpace [as 别名]
# 或者: from pypy.interpreter.baseobjspace.ObjSpace import unpackiterable_unroll [as 别名]
 def fixedview(self, w_obj, expected_length=-1, unroll=False):
     """ Fast paths
     """
     if isinstance(w_obj, W_AbstractTupleObject) and self._uses_tuple_iter(w_obj):
         t = w_obj.tolist()
     elif type(w_obj) is W_ListObject:
         if unroll:
             t = w_obj.getitems_unroll()
         else:
             t = w_obj.getitems_fixedsize()
     else:
         if unroll:
             return make_sure_not_resized(ObjSpace.unpackiterable_unroll(self, w_obj, expected_length))
         else:
             return make_sure_not_resized(ObjSpace.unpackiterable(self, w_obj, expected_length)[:])
     if expected_length != -1 and len(t) != expected_length:
         raise self._wrap_expected_length(expected_length, len(t))
     return make_sure_not_resized(t)
开发者ID:mozillazg,项目名称:pypy,代码行数:20,代码来源:objspace.py


注:本文中的pypy.interpreter.baseobjspace.ObjSpace.unpackiterable_unroll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。