
On 01/30/2013 09:04 PM, Larry Hastings wrote:
On 01/30/2013 08:22 PM, Ethan Furman wrote:
On 01/30/2013 05:53 PM, Larry Hastings wrote:
If we change math.pi to be a property it wouldn't be in the dict anymore. So that has the possibility of breaking code. So make the property access the __dict__:
In which case, it behaves exactly like it does today without a property. Okay... so why bother? If your answer is "so it can have code behind it", maybe you find a better example than math.pi, which will never need code behind it.
math.pi wasn't my example, I was just showing how you could use the __dict__ as well. Why bother? Backwards compatibility. I think I missed your main point of __dict__ access, though -- if it is set directly then the property doesn't get the chance to update whatever is supposed to update at the right moment, leading to weird (and most likely buggy) behavior. ~Ethan~