Re: properties vs. eval()

2005-05-05 Thread Bob Rogers
So you're saying you don't know the answer? The question wasn't "should I use setattr?" -- http://mail.python.org/mailman/listinfo/python-list

properties vs. eval()

2005-05-04 Thread Bob Rogers
Given this class: class C(object): def set_x(self, x): self._x = x def get_x(self): return self._x x = property(get_x, set_x) This use of compile() and eval() works as I expected it to: c = C() c.x = 5000 n = '\'five thousand\'' code = compile('c.x