12
Don't use Python's property
(www.b-list.org)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
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.