Python Programming - Decorators - Discussion

Discussion Forum : Decorators - General Questions (Q.No. 1)
1.
How does the @property decorator differ from regular methods in a Python class?
It defines a read-only property without a setter method
It marks a method as a class method
It is used to create private methods
It enables dynamic method invocation
Answer: Option
Explanation:
The @property decorator is used to define read-only properties in a class. It allows you to access a method as an attribute without the need for explicit getter methods. However, it doesn't provide a setter method, making the property read-only.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.