Using python property and still able to set the values explicitliy
<p>Im trying to understand how the @property decorator works.</p>

<p>Here I have used method y as a property for field x,</p>

<p>After the attribute-self.x has a property, does it mean that we can't set the value explicitly..</p>

<p>I thought  the last statement--> c.x = 2 will not work once you have the property method set on a variable?</p>

<pre><code>class C(object):
    def __init__(self):
        self.x = 0
        self.list = [1,2,3,4,10]
    @property
    def y(self):
        print 'getting'
        self.x = sum(self.list) 
        return self.x

    @y.setter
    def y(self, value):
        print 'setting'
        self.x = value

if __name__ == '__main__':
    c = C()
    print 'Value of c.y=',c.y
    print '-'*80
    c.y = 50
    print '-'*80
    print c.y
    print '-'*80
    if c.y &gt;5:
        print 'Hi'
</code></pre>
