2014-06-03 9:38 GMT-04:00 Simone Federici <s.feder...@gmail.com>: > class Dad(object): > def __str__(self): > return "value={}".format(self.value) > > class Son(Dad): > @property > def value(self): > return self._value > @value.setter > def value(self, value): > self._value = value*2 > > nel senso che quando hai scritto Dad non ti eri fatto il problema... >
Questa non puo' funzionare, invoco func anche con un Dad(). > > Oppure se Dad giĆ lo prevedeva... > > class Dad(object): > @property > def value(self): > return self._value > @value.setter > def value(self, value): > self._value = value > def __str__(self): > return "value={}".format(self.value) > > class Son(Dad): > @Dad.value.setter > def value(self, value): > self._value = value*2 > Doh! Cosi' si fa! :) Grazie mille, esattamente quello che volevo. Domanda filosofica: perche' non ho capito che potevo qualificare value.setter con Dad. nel decoratore? Cosa mi sfugge? Ciao, Giuliano -- Piergiuliano Bossi Blog: http://thinkingbox.wordpress.com/ Twitter: http://twitter.com/thinkingbox (English) Twitter: http://twitter.com/scatolapensante (Italiano) Google+: https://plus.google.com/u/0/108187981162465525118
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python