O'Reilly logo
  • Shobana Shanker thinks this is interesting:

All these methods return a single float value, so from the point of view of a user of these classes they could just as well be data attributes, but read-only, of course


Cover of Programming in Python 3: A Complete Introduction to the Python Language, Second Edition


any method that doesn't take any argument and returns a value can be potentially used an attribute. So instead of calling the method like method_name(), you will call it as method_name, essentially turning it into a non-callable data attribute as you would do with any attribute. I guess, you won't be able to do that if you have a method that takes any other argument other self, because the moment you have to pass something, it becomes a callable method. You just can't pass something to an attribute