Re: [Tutor] Python property()

2015-05-16 Thread Cameron Simpson
As Alan and I disagree on this, to a degree, I thought I would follow up to add another perspective. Remember that it is _only_ perspective; Alan's opinions are sound and have good reasons. So are mine:-) We place different values on the costs and benefits here. On 17May2015 00:27, alan.ga...@

Re: [Tutor] Python property()

2015-05-16 Thread Alan Gauld
On 16/05/15 20:25, daaku gee wrote: I think I understand what's going on here. What I don't understand is if/when to use property instead of a normal attribute. 1. Is 'property' used widely? Do you use it? No, Yes, occasionally I first came across properties in Borland Delphi (Object Pascal

[Tutor] Python property()

2015-05-16 Thread daaku gee
I came across some code where 'property' is being used for class attributes (or as a decorator @property) name = property(lambda self: getattr(self, '_data')['name']) I think I understand what's going on here. What I don't understand is if/when to use property instead of a normal attribute.