[issue21145] Add the @cached_property decorator

Éric Araujo report at bugs.python.org
Fri Apr 4 23:11:25 CEST 2014


Éric Araujo added the comment:

It could make sense to add clean, working recipes to e.g. the functools documentation.  The cached_property in the wiki uses a TTL, other like Pyramid’s reify decorator make properties that ensure the fget function is called only once per instance, and there may be subtly different variants out there.  I don’t know if there’s a universally useful variant that should be added to the sdlib right now.  (I don’t think a C implementation is needed.)

On a related note, the Python docs about desciptors may be missing entry-level explanations, as described here: http://me.veekun.com/blog/2012/05/23/python-faq-descriptors/

----------
nosy: +eric.araujo, rhettinger

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


More information about the Python-bugs-list mailing list