[issue21145] Add the @cached_property decorator

Carl Meyer report at bugs.python.org
Sat May 19 00:59:10 EDT 2018


Carl Meyer <carl at oddbird.net> added the comment:

Sent a PR with the patch.

Nick, I tried your `__set_name__` proposal to get an earlier error in case of an object with slots, but it has the downside that Python seems to always raise a new chained exception if `__set_name__` raises any exception. So instead of getting a clear error, you get an opaque one about "error raised when calling __set_name__ on...", and you have to scroll up to see the real error message. I felt that this was too much usability regression and not worth the benefit of raising the error sooner. Let me know if you feel otherwise.

----------

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


More information about the Python-bugs-list mailing list