def vars(self): for x in self.members(): if is_var(x): yield x elif is_obj(x): for y in x.vars(): yield y
def set_name(obj,name,overwrite=False): if is_var(obj) or is_obj(obj): if overwrite or obj.is_anon(): obj.set_name(name) elif is_expr(obj) or is_num(obj): return else: assert 0
def test_pt_init(self): p1 = Point(3,4) p2 = Point(p1.y,Var()) p3 = Point(4,44) self.assertTrue( pyl.is_num(p1.x) ) self.assertTrue( pyl.is_num(p1.y) ) self.assertTrue( pyl.is_num(p2.x) ) self.assertTrue( pyl.is_var(p2.y) ) self.assertEqual( p2.x, 4 ) p2 [:]= p3 self.assertEqual( p2.y.val(), 44 )