Python·100 questions

What is @property and when to use it?

Answer
Makes the method look like a field.
Allows computed properties.
You can add validation in setter.
Helps hide internal representation.
Don't abuse — complexity also increases.
Was this answer helpful?

More questions in this topic

Related questions from other topics