newb question about @property
Bill
BILL_NOSPAM at whoknows.net
Sat Sep 30 19:18:11 EDT 2017
Ned Batchelder wrote:
> 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.
I am basically mimmicking what I see at (the very bottom of) this page:
https://www.programiz.com/python-programming/property
Thanks,
Bill
More information about the Python-list
mailing list