Message135990
2011/5/14 Darren Dale <report@bugs.python.org>:
>
> Darren Dale <dsdale24@gmail.com> added the comment:
>
> On Sat, May 14, 2011 at 4:28 PM, Benjamin Peterson
> <report@bugs.python.org> wrote:
>>
>> Benjamin Peterson <benjamin@python.org> added the comment:
>>
>> I still dislike the reduntancy of having abstractmethod and abstractproperty on a method. I think a better idea is having abstractproperty.abstract(getter/setter/deleter).
>
> Right, but I explained why the redundancy is necessary in order to
> preserve backwards compatibility. If the abstractproperty constructor
> were changed to tag methods it receives as abstract, it would be a
> backwards-incompatible change in behavior with potential consequences
> for consumers of abstractproperty.
I'm not suggesting that it tag methods it receives as abstract.
@getter/setter/deleter would still act the same.
> abstractproperty.abstract(getter/setter/deleter) could be implemented,
> but it still wouldn't change the fact that if a getter/setter is
> intended to be abstract, it needs to be decorated with @abstractmethod
> before being passed to the abstractproperty() constructor.
Why not? You could set the __abstractmethod__ attribute in abstractgetter().
> This is
> true today in <=python-3.2: its not mentioned in the documentation,
> but the behavior exists all the same.
>
> Properties are composite objects, their behavior is defined by it is
> the setters/getters/deleters they receive. So its actually a very
> conceptually clean solution to decorate a method with @abstractmethod,
> and it fits really nicely with the rest of the abc module. Why does
> abstractproperty need special abstract(setter/getter/deleter) methods,
> when the existing methods combine with @abstractmethod in a clean way
> to produce the exact same result? To save one line of code?
I find it produces a rather unfortunate ordering dependency for the
decorators which is hard to remember. |
|
Date |
User |
Action |
Args |
2011-05-14 21:17:24 | benjamin.peterson | set | recipients:
+ benjamin.peterson, ncoghlan, ned.deily, daniel.urban, dsdale24, Darren.Dale |
2011-05-14 21:17:23 | benjamin.peterson | link | issue11610 messages |
2011-05-14 21:17:23 | benjamin.peterson | create | |
|