From: Hal Fulton Date: 2006-01-05T12:29:18+09:00 Subject: Re: Can't change the value of self Henrik Martensson wrote: > Immutable classes are less prone to bugs than mutable classes. This is > because they have a single state. They are also thread safe. > > It is good practise to favor immutability when there are no compelling > reasons for making a class mutable. > > A Time object represents an instance in time. Making it mutable could > easily get confusing. Consider: > > time = MutableTime.at(946702800) > rocket.launch_time = time > ... > time.change(946701565) # Changes the launch time of the rocket > > > The launch time of the rocket can be changed without setting the > launch_time property explicitly. This is a potential source of bugs. Thanks, Henrik. That's a great discussion and a great example. Hal