Matt Wilber <mattwilbe...@gmail.com> added the comment:

This allows a developer to add a @cached_property to a method with the 
@abstractmethod decorator, without breaking the check for abstract methods on 
ABC instantiation. That is, if you tried to instantiate an ABC with a method 
that had a method decorated with @cached_property and @abstractmethod now, it 
would succeed, instead of throwing a TypeError as you might expect.

As for why you'd put @cached_property on an abstract method, it's useful for 
IDEs and type checkers to know that the method is implemented with a property, 
and that users of the method (and its implementations) can reasonably call it 
multiple times and know caching is occurring.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34995>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to