On 5/19/2010 1:14 AM, Vincent Davis wrote: > class C(object): >> def __init__(self, new): >> self.letter = dict(a=1,b=2,c=3, amin=np.amin) >> self.new = new >> self._x = None >> self._Y = None >> >> @property >> def x(self): >> """I'm the 'x' property.""" >> self._x = self.new >> return self._x >> > I just wanted to point out that your
self._x = self.new does not give you a new object. Instead, _x is assigned a reference that points to this object called 'new', which is passed in during the class initialisation. I think your variable naming needs some improvement to show/correct your understanding. Also, you can just use `x` and `y` for the variable names; you don't need the underscore. If you want to use a pseudo-private variable, use __x (double prefix underscore) instead. Cheers, Xav
-- http://mail.python.org/mailman/listinfo/python-list