[Python] AttributeError: 'cached_property' object has no attribute 'setter'

Discussão em 'Python' iniciado por Stack, Maio 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using the functools.cached_property to memoize some functions.

    but it seems not to be supporting setter.

    for example

    class User
    @cached_property
    def name(self):
    return self._name

    @name.setter
    def name(self, val):
    self._name = val


    but when importing i encountered AttributeError: 'cached_property' object has no attribute 'setter'

    Continue reading...

Compartilhe esta Página