The @property decorator

The @property decorator makes height a getter method for a read-only attribute:

 
#!/usr/bin/env python
class A( object):
    def __init__( self):
        self._height = 1.89

    @property 
    def height( self):
        return self._height

a = A()

print( a.height)

a.height = 2

Traceback (most recent call last):
  File "t1.py", line 14, in <module>
    a.height = 2
AttributeError: can't set attribute