Laurie Opperman <laurie_opper...@hotmail.com> added the comment:

Turns out, that as a non-data descriptor, a cached property already has 
setting/updating and clearing through the normal mechanisms in Python. This 
feature request is therefore redundant: perhaps a new issue to document this 
inherent behaviour?

Unless you explicitly want to make cached property updating not allowed, but 
that's easily implemented in application code by sub-classing 
`functools.cached_property` and defining `__set__` and `__delete__` to raise:

    class unupdatable_cached_property(functools.cached_property):
        def __set__(self, instance, value):
            raise AttributeError("can't set attribute")

        def __delete__(self, instance):
            raise AttributeError("can't delete attribute")

----------
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

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

Reply via email to