overriding a property that has no getter or setter in python

My code :

class parent(object):
    
    @property
    def value(self):
        return self.val

class child(parent):
    #__init__

    @parent.value.setter
    def value(self):
        return self.get_val()

This code is not setting the property value to self.get_val() , instead it is using the old value that is set in the parent.

Here , the parent class has no specific setter method but I need to set the property to a different value in the subclass. How do I do it ? Please help.

Source: Python-3x Questions

LEAVE A COMMENT