Which decorator in Python is commonly used to define a method as a class property getter?

  • @get
  • @getter
  • @method
  • @property
To define a method as a class property getter in Python, the @property decorator is commonly used. This decorator allows you to access a method like an attribute, making it a clean way to implement read-only properties in classes.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *