Exemplo n.º 1
0
 def unpack_sequence(self, w_iterable, expected_length):
     w_len = op.len(w_iterable).eval(self)
     w_correct = op.eq(w_len, const(expected_length)).eval(self)
     if not self.guessbool(op.bool(w_correct).eval(self)):
         w_exc = self.exc_from_raise(const(ValueError), const(None))
         raise Raise(w_exc)
     return [op.getitem(w_iterable, const(i)).eval(self)
             for i in range(expected_length)]
Exemplo n.º 2
0
 def unpack_sequence(self, w_iterable, expected_length):
     w_len = op.len(w_iterable).eval(self)
     w_correct = op.eq(w_len, const(expected_length)).eval(self)
     if not self.guessbool(op.bool(w_correct).eval(self)):
         w_exc = self.exc_from_raise(const(ValueError), const(None))
         raise Raise(w_exc)
     return [op.getitem(w_iterable, const(i)).eval(self)
             for i in range(expected_length)]