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.

24th Dec 2016, 12:59 AM
Erno Isokangas
Erno Isokangas - avatar
1 Answer
+ 1
With the getter syntax you can switch getter function to a simple object attribute and back transparently to the users of your class.
26th Dec 2016, 8:44 AM
Igor B
Igor B - avatar