[Python-ideas] Extend module objects to support properties (original) (raw)
Ethan Furman ethan at stoneleaf.us
Thu Jan 31 23:13:38 CET 2013
- Previous message: [Python-ideas] Extend module objects to support properties
- Next message: [Python-ideas] Extend module objects to support properties
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-ideas] Extend module objects to support properties
- Next message: [Python-ideas] Extend module objects to support properties
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]