Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Nagy László Zsolt
> Yes, the get part works. The set part is a pain, and a bit ugly: > > super(B, B).foo.__set__(self, value) > > There is an issue for this on the tracker: > http://bugs.python.org/issue14965 > Thank you Ethan! The superprop pure Python implementation is very promising. ( http://bugs.python.or

Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Ethan Furman
On 09/11/2016 08:28 AM, Peter Otten wrote: Nagy László Zsolt wrote: Yes, I believe it does. (Others may disagree. This is a design question and very much a matter of style, not hard fact.) I would have an explicit action "set_content" which will set the value of an input field, the inner text

Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Peter Otten
Nagy László Zsolt wrote: > >> Yes, I believe it does. (Others may disagree. This is a design >> question and very much a matter of style, not hard fact.) I would have >> an explicit action "set_content" which will set the value of an input >> field, the inner text of a textarea, the checked state

Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Nagy László Zsolt
Yes, I believe it does. (Others may disagree. This is a design question and very much a matter of style, not hard fact.) I would have an explicit action "set_content" which will set the value of an input field, the inner text of a textarea, the checked state of a check box, etc. In other words,

Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Chris Angelico
On Sun, Sep 11, 2016 at 9:31 PM, Nagy László Zsolt wrote: > The "value of a form field" must have a unified interface. So when I do > " textfield.value = some_value " then I expect that the changed value > will be represented on the UI *if it has an UI representation*. The > widget needs to be abl

Re: Override property setter of base class in Python 3

2016-09-11 Thread Chris Angelico
On Sun, Sep 11, 2016 at 9:17 PM, Nagy László Zsolt wrote: >> Subclassing and overriding are part of the interface of a class, >> albeit an interface that only a subset of other classes will use. >> Think carefully about why, if this is meant to be made available, it >> isn't simply a method call.

Re: Override property setter of base class in Python 3 - USE CASE

2016-09-11 Thread Nagy László Zsolt
> Even the problem seems to rather defeat the purpose of a property. A > property should be very simple - why do you need to override it and > call super()? Doesn't this rather imply that you've gone beyond the > normal use of properties *already*? Here are some of my classes that can represent da

Re: Override property setter of base class in Python 3

2016-09-11 Thread Nagy László Zsolt
> Even the problem seems to rather defeat the purpose of a property. A > property should be very simple - why do you need to override it and > call super()? Doesn't this rather imply that you've gone beyond the > normal use of properties *already*? I'm not sure about that. I'm going to send a USE

Re: Override property setter of base class in Python 3

2016-09-11 Thread Chris Angelico
On Sun, Sep 11, 2016 at 8:02 PM, Nagy László Zsolt wrote: > But this solution almost defeats the purpose of properties. E.g. a > property should look like an attribute, and its behaviour should be > manipulated through its name (and not another special method that must > be exposed to subclasses.)

Re: Override property setter of base class in Python 3

2016-09-11 Thread Nagy László Zsolt
By the way, I know that I can use a "property virtualizer", something like this: import inspect class A: def __init__(self, prop=0): self.__prop = prop def _prop_get(self): return self.__prop def _prop_set(self, value): self.prop_set(value)