[issue11610] Improving property to accept abstract methods

Benjamin Peterson report at bugs.python.org
Sun May 15 00:24:12 CEST 2011


Benjamin Peterson <benjamin at python.org> added the comment:

2011/5/14 Darren Dale <report at bugs.python.org>:
>
> Darren Dale <dsdale24 at gmail.com> added the comment:
>
> On Sat, May 14, 2011 at 5:55 PM, Benjamin Peterson
> <report at bugs.python.org> wrote:
>>
>> Benjamin Peterson <benjamin at python.org> added the comment:
>>
>> Okay: how about this. We retain the passing of @abstractmethod to
>> abstractpropert(), but @abstractgetter decorates the method for you.
>
> That can work, although I would advise against it. I find it strange
> that we would use @abstractmethod sometimes and not others. If that is
> what it takes to get the patch accepted, so be it. But since I don't
> understand the motivation behind this approach, I won't be the one to
> document the special cases of when @abstractmethod is required and
> when it is not.

It would just be a convenience.

> It definitely is a common case, and always will be. You can't begin
> using abstractproperty.abstract(getter/setter/deleter) until you have
> an abstract property, which requires passing a (potentially abstract)
> method to the constructor.

What about

@abstractproperty
def something(): pass

@abstractproperty.setter
def set(): pass

@abstractproperty.deleter
def delete: pass

requires you to pass a method (explicitly) to a constructor?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11610>
_______________________________________


More information about the Python-bugs-list mailing list