You can do this in Python as well. Check out the property built-in
function. One can declare a property with a get, set, and delete
method. Here's a small example of a read-only property.

class Test(object):
    def getProperty(self):
        return 0;

    prop = property(fget = getProperty)
    
t = Test()

print t.prop

t.prop = 100 # this will fail

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to