Re: Extending property using a Subclass - single method - why Super(Baz, Baz).name.__set__ ?

2019-12-03 Thread Peter Otten
Veek M wrote: > you've misunderstood my question There were a lot of foobars bazzing in my head, but at least I tried ;) > , let me try again: > > So this is a simple descriptor class and as you can see, dunder-set needs > 3 args: the descriptor CONTAINER/Bar-instance is the first arg, then a

Re: Extending property using a Subclass - single method - why Super(Baz, Baz).name.__set__ ?

2019-12-03 Thread Veek M
you've misunderstood my question, let me try again: So this is a simple descriptor class and as you can see, dunder-set needs 3 args: the descriptor CONTAINER/Bar-instance is the first arg, then a reference to the using instance/Foo-instance class Bar(object): def __set__(self,

Re: Extending property using a Subclass - single method - why Super(Baz, Baz).name.__set__ ?

2019-12-03 Thread Peter Otten
Veek M wrote: > class Foo(object): > @property > def name(self): > if hasattr(self, '_name'): > print('Foo name', self._name) > return self._name > else: > return 'default' > > @name.setter > def name(self, value): >

Extending property using a Subclass - single method - why Super(Baz, Baz).name.__set__ ?

2019-12-03 Thread Veek M
class Foo(object): @property def name(self): if hasattr(self, '_name'): print('Foo name', self._name) return self._name else: return 'default' @name.setter def name(self, value): print('Foo', self) self._name =