[New-bugs-announce] [issue38545] Implement setter and deleter on functools.cached_property

Laurie Opperman report at bugs.python.org
Mon Oct 21 06:31:01 EDT 2019


New submission from Laurie Opperman <laurie_opperman at hotmail.com>:

Support setting/updating and clearing the cached value of a cached-property (getter implemented by bpo-21145). Pretty straight-forward to implement

The question is whether cached-property updating should be:
a) always allowed
b) enabled with a cached-property instance attribute
c) enabled with the decorated method's class attribute
d) enabled with the decorated method's instance attribute
e) enabled in a separate decorator (eg functools.updatable_cached_property)

Note: options a, b, c, and d will make functools.cached_property a data descriptor.

I prefer option b or c, as the decision to make the property updatable becomes the property's definer's.

Also, should a warning be raised if a cached value is being overwritten? Should a warning be raised if no cached value is to be deleted?

----------
components: Library (Lib)
messages: 355045
nosy: Epic_Wink
priority: normal
severity: normal
status: open
title: Implement setter and deleter on functools.cached_property
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38545>
_______________________________________


More information about the New-bugs-announce mailing list