You can use the exact same template in Python. You seem to be worried about whether my_object.get_foo() needs to be done all the time in Pythonic. Fortunately, Python gives you a good tool to work here in the form of properties :
class my_class(object): @property def foo(self):
This allows you to use something that is used as an attribute, even if it is implemented as a function. those. users will do my_object.foo , and do not care that it performs the function behind the scenes.
Another thing is that the Python convention says that private attributes are written by _foo , not mFoo .
source share