Jason NovingerM to [email protected] • 11 months agoDon't use Python's propertywww.b-list.orgmessage-square6fedilinkarrow-up113arrow-down13
arrow-up110arrow-down1external-linkDon't use Python's propertywww.b-list.orgJason NovingerM to [email protected] • 11 months agomessage-square6fedilink
minus-squareTroylinkfedilink18•11 months agoTl;dr: don’t use @property during design, it’s almost certainly the wrong pattern. But use it to retrofit a method to a value.
minus-square@[email protected]linkfedilink2•11 months agoYup. I pretty much only use it if I need to ensure new values are valid or provide a default value. I do the same in other languages, like C# and JavaScript. Properties are cool, but should be quite rare.
Tl;dr: don’t use @property during design, it’s almost certainly the wrong pattern. But use it to retrofit a method to a value.
Yup. I pretty much only use it if I need to ensure new values are valid or provide a default value.
I do the same in other languages, like C# and JavaScript. Properties are cool, but should be quite rare.