[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2019-03-27 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-20 Thread INADA Naoki
INADA Naoki added the comment: My personal opinion is: support abstractmethod only when the descriptor is useful for define interface with ABC. In case of cached_property, it's not. It is just a property as interface level. Caching is just an implementation. In case of update_wrapper, it'

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-20 Thread Matt Wilber
Matt Wilber added the comment: Inada-san, I think it's fair to ask for a broader vision about how ABCs are used. In that respect I'm wondering about some inconsistencies in the existing functools module about whether wrappers should maintain the wrapped function's __isabstractmethod__ attrib

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-20 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-20 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: I am with Inada-san actually. I would go as far as saying that @cached_property @abstractmethod def something(): ... should unconditionally raise on definition. Mostly because this is just misleading. This declaration doesn't guarantee that the implementati

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-19 Thread INADA Naoki
INADA Naoki added the comment: I worried about people think we recommend it when we support it, while this is just a request from one person, not recommendation after wide discussion. But it doesn't affect to static tools than I suspected. Tools like autocompletion should support cached_pro

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-17 Thread STINNER Victor
STINNER Victor added the comment: INADA-san: do you prefer to raise an exception? If yes, can we ensure that an exception will always be raised? See my 2 examples. -- ___ Python tracker _

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-16 Thread Guido van Rossum
Guido van Rossum added the comment: In mypy there would be no difference between a cached property and a normal one -- the type is the same either way. Caching is the quintessential runtime behavior -- it shouldn't matter for semantics, only for performance. (True, sometimes there are more s

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-16 Thread INADA Naoki
INADA Naoki added the comment: > Guido van Rossum added the comment: > > This is runtime behavior, mypy doesn't care either way. It triggers on the > presence of the decorator, not on what attributes it sets at runtime on the > object. > > But it's only motivation is static hinting. My point

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-16 Thread Guido van Rossum
Guido van Rossum added the comment: This is runtime behavior, mypy doesn't care either way. It triggers on the presence of the decorator, not on what attributes it sets at runtime on the object. -- ___ Python tracker

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-16 Thread INADA Naoki
INADA Naoki added the comment: I want to hear mypy developer's comment. -- nosy: +gvanrossum, levkivskyi ___ Python tracker ___ ___

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-26 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-25 Thread INADA Naoki
INADA Naoki added the comment: > I like the idea of using @functools.cached_property in an abstract class as > "documentation". To announce that the property will be cached, even if > technically it will not be cached. It's more to use the code as documentation > than to execute any code.

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-25 Thread Carl Meyer
Carl Meyer added the comment: FWIW, it seems to me (author of `cached_property` patch) that while just using `@property` on the abstract method plus a comment is a reasonable and functional workaround that sacrifices only a small documentation value, there's no reason why `@cached_property`

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: Context: @functools.cached_property has been added by bpo-21145. -- ___ Python tracker ___ ___ Py

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-25 Thread STINNER Victor
STINNER Victor added the comment: Exmaple 1: --- import abc import functools class AbstractExpensiveCalculator(abc.ABC): @abc.abstractmethod @functools.cached_property def calculate(self): pass AbstractExpensiveCalculator() --- Exmaple 2: --- import abc import functools

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-20 Thread INADA Naoki
INADA Naoki added the comment: I agree with Serhiy. For static hinting, `@property` should be enough. I think tools like mypy should support this pattern: class MyABC(metaclass=ABCMeta): @property @abstractmethod def myprop(self): ... class MyConcrete(MyABC): @cached_

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Well, you can combine @abstractmethod with @property in an abstract class. This will give you type hints etc. @cached_property is a detail of concrete implementation. -- ___ Python tracker

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-17 Thread Matt Wilber
Matt Wilber added the comment: To add some more context, the existing Python documentation is a little misleading in this situation: https://docs.python.org/3/library/abc.html#abc.abstractmethod It shows that labeling a method with @property @abstractmethod ought to be done in the order ab

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-17 Thread Matt Wilber
Matt Wilber added the comment: I agree, a comment can serve the same purpose. But for the same reasons it's useful to express typing hints in Python with real syntax, and the reasons it's useful to have the abc module in the first place, I think it is useful to be able to annotate an abstrac

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The comment can serve the same purpose. The caching affects the behavior at run time. Abstract methods should not be executed. The cached_property decorator is not inherited by overriding properties. I don't think that combining the cached_property and the

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-15 Thread Matt Wilber
Matt Wilber 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 @c

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-15 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : What is the use case of this? -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bu

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-15 Thread Matt Wilber
Change by Matt Wilber : -- keywords: +patch pull_requests: +9266 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-10-15 Thread Matt Wilber
Change by Matt Wilber : -- components: Library (Lib) nosy: mwilbz priority: normal severity: normal status: open title: functools.cached_property does not maintain the wrapped method's __isabstractmethod__ versions: Python 3.8 ___ Python tracker