Message215655
| Author | Omer.Katz |
|---|
| Recipients | Omer.Katz, eric.araujo, madison.may, rhettinger, vstinner |
|---|
| Date | 2014-04-06.10:49:45 |
|---|
| SpamBayes Score | -1.0 |
|---|
| Marked as misclassified | Yes |
|---|
| Message-id | <CAOZCFcAFDMAM77tdRkyd8mtnXXjB-h=E6iKdsmFKekRMB5hHBA@mail.gmail.com> |
|---|
| In-reply-to | <CAOZCFcA_DVMyZ9Zro1ccG_+qDTvqrY9y7tLSc4B_RxcBj9BiQA@mail.gmail.com> |
|---|
| Content |
|---|
I just checked and werkzeug uses the same implementation as Django & pip.2014-04-06 14:31 GMT+04:00 Omer Katz <report@bugs.python.org>:>> Omer Katz added the comment:>> The default implementation should simple:> Once the property is accessed for the first time calculate the result and> never calculate again.> It's what both Django & pip uses.> You can add an optional TTL.> There aren't any other features I can come up with that are common enough.> If needed, one can inherit from cached_property and do whatever is needed.> Eric, Why don't you think a C implementation is needed? It's a simple> operation for sure but it is meant to increase runtime efficiency.>> 2014-04-05 1:11 GMT+04:00 Éric Araujo <report@bugs.python.org>:>> >> > É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@bugs.python.org>> > <http://bugs.python.org/issue21145>> > _______________________________________> >>> ---------->> _______________________________________> Python tracker <report@bugs.python.org>> <http://bugs.python.org/issue21145>> _______________________________________> |
|