This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ramalho
Recipients docs@python, ramalho
Date 2020-12-29.18:12:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609265578.67.0.475985633003.issue42781@roundup.psfhosted.org>
In-reply-to
Content
functools.cached_property is a great addition to the standard library, thanks!

However, the docs do not say that @cached_property produces a non-overriding descriptor, in contrast with @property.

If a user replaces a @property with a @cached_property, her code may or may not break depending on the existence of an instance attribute with the same name as the decorated method. This is surprising and may affect correctness, so it deserves even more attention than the possible performance loss already mentioned in the docs, related to the shared-dict optimization.

In the future, perhaps we can add an argument to @cached_property to optionally make it produce overriding descriptors.
History
Date User Action Args
2020-12-29 18:12:58ramalhosetrecipients: + ramalho, docs@python
2020-12-29 18:12:58ramalhosetmessageid: <1609265578.67.0.475985633003.issue42781@roundup.psfhosted.org>
2020-12-29 18:12:58ramalholinkissue42781 messages
2020-12-29 18:12:58ramalhocreate