[issue11610] Improving property to accept abstract methods

Darren Dale report at bugs.python.org
Sun May 15 00:36:35 CEST 2011


Darren Dale <dsdale24 at gmail.com> added the comment:

On Sat, May 14, 2011 at 6:24 PM, Benjamin Peterson
<report at bugs.python.org> wrote:
>
> 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:
>>
>> 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?

@abstractproperty
def something(): pass

takes the "something" function and passes it to the abstractproperty()
constructor.

It doesn't appear that you are familiar with how the decorator syntax
works for properties. Here is how your example should probably look:

@abstractproperty
def something(): pass

@something.setter
def something(): pass

@something.deleter
def something(): pass

----------

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


More information about the Python-bugs-list mailing list