[issue38524] functools.cached_property is not supported for setattr

hongweipeng report at bugs.python.org
Sat Oct 19 10:55:55 EDT 2019


hongweipeng <hongweichen8888 at sina.com> added the comment:

Is it possible to add an attrname parameter? It is more convenient to use.

class cached_property:
    def __init__(self, func, attrname=None):
        self.attrname = attrname
        ...

cls.age3 = cached_property(age, 'age3')

----------

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


More information about the Python-bugs-list mailing list