On 31-Mar-05, at 3:53 PM, Beni Cherniavsky wrote:
There are still times when you don't want to expose attributes directly, but getters and setters don't help you there either. For example, if both myObj.x and myObj.y must be changed in synch to stay valid, then they should be set via myObj.setXandY(x,y) not myObj.x = newX, myObj.y = newY. But this is a design problem not a language problem.myObj.xy = (x, y)
Rule of thumb: use tuples where you typically change all members together. Use mutable objects (lists/dicts/objects with attrs) where you frequently change individual members.
Good point. Python solves another design problem. Is there anything it can't do?
--Dethe
I can't watch television without praying for nuclear holocaust. --Bill Hicks
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig