[issue41523] functools.cached_property does not satisfy the property check

2020-08-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue41523] functools.cached_property does not satisfy the property check

2020-08-17 Thread William Pickard
William Pickard added the comment: Another thing to note Raymond, as I stated before, example C is, from an external context, is a plain property object who's "fget" attribute is an instance of whatever "lru_cache" returns. isinstance won't be able to differentiate between example "a" and

[issue41523] functools.cached_property does not satisfy the property check

2020-08-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: I recommend closing this. As Serhiy pointed out, they are profoundly different. Currently, a user can rely on the isinstance() check to differentiate them. So, changing the behavior would be a regression. AFAICT, a user would not be able to deduce

[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > They are both descriptors, but cached_property is not a data descriptor. I think this is one of the key reasons this should not return "True" for isinstance(A.b, property). Also, cached_property does not allow you to implement a setter or a

[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread William Pickard
William Pickard added the comment: In the lru_cache example, I think property is using the result of 'lru_cache(c)', which in turns returns a property instance, not a subtype instance. -- nosy: +WildCard65 ___ Python tracker

[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread Bernát Gábor
Bernát Gábor added the comment: I think they're implemented differently and have slightly different semantics, but they're equal from a user point of view most of the time 樂 -- nosy: +Bernát Gábor ___ Python tracker

[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There are not much things common to property and cached_property. cached_property does not have attributes fget, fset, fdel. They are both descriptors, but cached_property is not a data descriptor. -- ___

[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread Bernat Gabor
Bernat Gabor added the comment: I understand under the hood they're differenet, however I think cached_property wanted to be a shorter/better version of @property@lru_cache which does passes this check. Tools expecting properties to pass that check now need to extend their check... and

[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: No, cached_property is a completely different class. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread Bernat Gabor
New submission from Bernat Gabor : from functools import cached_property, lru_cache class A: @property def a(self): return '' @cached_property def b(self): return '' @property @lru_cache def c(self): return "" print(isinstance(A.a, property))