Ejemplo n.º 1
0
 def viewiterable(self, w_obj, expected_length=-1):
     """ Fast paths
     """
     if isinstance(w_obj, W_TupleObject):
         t = w_obj.wrappeditems
     elif isinstance(w_obj, W_ListObject):
         t = w_obj.wrappeditems[:]
     else:
         return ObjSpace.viewiterable(self, w_obj, expected_length)
     if expected_length != -1 and len(t) != expected_length:
         raise UnpackValueError("Expected length %d, got %d" % (expected_length, len(t)))
     return t
Ejemplo n.º 2
0
 def viewiterable(self, w_obj, expected_length=-1):
     """ Fast paths
     """
     if isinstance(w_obj, W_TupleObject):
         t = w_obj.wrappeditems
     elif isinstance(w_obj, W_ListObject):
         t = w_obj.wrappeditems[:]
     else:
         return ObjSpace.viewiterable(self, w_obj, expected_length)
     if expected_length != -1 and len(t) != expected_length:
         raise UnpackValueError("Expected length %d, got %d" %
                                (expected_length, len(t)))
     return t