Foodei

u/Foodei



r/learnpython•

I'm trying to understand the above and have the following code:

class Aclass:
    def __init__(self, aval):
        print(f'__init__')
        self.val = aval

    @property
    def val(self):
        print(f'Getting value _val < {self._val}', end=' ')
        return (self._val)

    @val.setter
    def val(self, aval):
        self._val = aval
        print(f'Setting value _val > {self._val}')

    @property
    def newval(self):
        self._val = self._val * 10
        print(f'Setting newvalue > {self._val}', end=' ')
        return (self._val)

def main():
    print ('--1--')
    my
22