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 serhiy.storchaka
Recipients carljm, docs@python, hongweipeng, ncoghlan, serhiy.storchaka, steven.daprano
Date 2019-10-19.09:23:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1571476998.16.0.149191606526.issue38524@roundup.psfhosted.org>
In-reply-to
Content
You have to call __set_name__() if you create a cached_property dynamically outside of the class namespace.

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

(And setattr() is not needed here.)
History
Date User Action Args
2019-10-19 09:23:18serhiy.storchakasetrecipients: + serhiy.storchaka, ncoghlan, carljm, steven.daprano, docs@python, hongweipeng
2019-10-19 09:23:18serhiy.storchakasetmessageid: <1571476998.16.0.149191606526.issue38524@roundup.psfhosted.org>
2019-10-19 09:23:18serhiy.storchakalinkissue38524 messages
2019-10-19 09:23:18serhiy.storchakacreate