Can cached_property be a subclass of property?
aldanor opened this issue · 3 comments
There are certain pieces of code in some libraries, linters and static analyzers that check things like
if isinstance(attr, property):
do_something()
This is especially important for use in metaclasses.
Obviously this fails with cached property; would it be possible to derive it from property
so isinstance/issubclass checks work as expected?
That's a fun idea! There isn't a stupid-quick fix for this: I quickly checked and if we inherit all the cached-property
classes from Python's property
built-in, then a third of the unit tests fail.
But I'm pretty certain there's a way to do it.
since the python property is a data-property, that would mean always having a slow implementation
the properties with annotations/ttl however look like a good candidate for that