Bob Gailer wrote: > I really like the simplicity of a.b = 3. I groan when put in other > environments where a method call is required. > > And Python has the magic method __setattr__ to intercept attribute > assignment for the times where some inspection / protection / > side-effect action is desired.
The modern way to do this (since Python 2.2 I think) is to use properties. __setattr__ has other uses (for example for delegation) but it is too big a hammer for changing the behaviour of a single attribute. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor