0
Defining a getter for a property?
I've been playing around with properties in Python for a little while now and I've been wondering: is there some kind of specific situation in which one would need to make a getter for a property? Because as far as I've noticed, the method you declare as a property can already function as a getter. Because I think this is not just about conforming with the setter/getter framework idea but that there is some good reason behind it one is able to define a getter.
1 Antwort
+ 1
With the getter syntax you can switch getter function to a simple object attribute and back transparently to the users of your class.