Static caching property

Ian Kelly ian.g.kelly at gmail.com
Mon Mar 21 12:15:18 EDT 2016


On Mon, Mar 21, 2016 at 9:38 AM, Joseph L. Casale
<jcasale at activenetwerx.com> wrote:
> With non static properties, you can use a decorator that overwrites the
> method on the instance with an attribute containing the methods return
> effectively caching it.

Can you give an example of what you mean?

> What technique for a static property can be used to accomplish what the
> descriptor protocol does?
>
> I need to cache the results of a method on a class across all instances.

Why not do the same thing but using a class attribute instead of an
instance attribute?



More information about the Python-list mailing list