Re: [Tutor] automatic setting of class property when another one changes

2016-09-15 Thread Steven D'Aprano
On Thu, Sep 15, 2016 at 12:30:34PM +0200, ingo wrote: > Rather stuck with this one, I'd like to automatically (re)set the > propery "relaystate" when one of the others (Tm, Tset, Th) is set, > regardless of wether their value has changed. The obvious way is to make Tm, etc properties, and have

Re: [Tutor] automatic setting of class property when another one changes

2016-09-15 Thread Peter Otten
ingo wrote: > Rather stuck with this one, I'd like to automatically (re)set the > propery "relaystate" when one of the others (Tm, Tset, Th) is set, > regardless of wether their value has changed. The easiest way to achieve your goal seems to be a read-only property: # this creates a class that

[Tutor] automatic setting of class property when another one changes

2016-09-15 Thread ingo
Rather stuck with this one, I'd like to automatically (re)set the propery "relaystate" when one of the others (Tm, Tset, Th) is set, regardless of wether their value has changed. Ingo My code so far: from collections import namedtuple import logging logger = logging.getLogger()