[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
newb question about @property
On 9/30/17 5:47 PM, Bill wrote:
> I spent a few hours experimenting with @property. To my mind it seems
> like it would be preferable to just define (override) instance methods
> __get__(), __set__(), and possibly __del__(), as desired, as I could
> easily provide them with "ideal" customization. Am I overlooking
> something?
>
It would be easier to comment if you showed the two options. One with
@property, and one with __get__ etc.
A downside to __get__ is that you need to create a class with those
methods, and then instantiate that class as an attribute in your real
class, whereas @property can be used without a lot of rigamarole.
--Ned.