Jak zrobić getter w Python

class C(object):
    def __init__(self):
        self._x = 'Foo'

    @property
    def x(self):
        """I'm the 'x' property."""
        print("getter of x called")
        return self._x


c = C()
print(c.x)    # Outputs "Foo"
Oscar Berge