Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105368

Re: Static caching property

From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Static caching property
Date 2016-03-21 10:15 -0600
Message-ID <mailman.446.1458576961.12893.python-list@python.org> (permalink)
References <35a5c4206a0c40e584d62d5d37b068b3@activenetwerx.com>

Show all headers | View raw


On Mon, Mar 21, 2016 at 9:38 AM, Joseph L. Casale
<jcasale@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?

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Static caching property Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-21 10:15 -0600
  Re: Static caching property Steven D'Aprano <steve@pearwood.info> - 2016-03-22 03:36 +1100
    Re: Static caching property "Joseph L. Casale" <jcasale@activenetwerx.com> - 2016-03-21 16:49 +0000
    Re: Static caching property Chris Angelico <rosuav@gmail.com> - 2016-03-22 03:54 +1100
    Re: Static caching property "Joseph L. Casale" <jcasale@activenetwerx.com> - 2016-03-21 17:03 +0000
    Re: Static caching property Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-21 11:44 -0600
    Re: Static caching property Ethan Furman <ethan@stoneleaf.us> - 2016-03-21 10:45 -0700
    Re: Static caching property Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-21 11:48 -0600
      Re: Static caching property Steven D'Aprano <steve@pearwood.info> - 2016-03-22 11:05 +1100
        Re: Static caching property Chris Angelico <rosuav@gmail.com> - 2016-03-22 11:15 +1100
        Re: Static caching property Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-22 07:30 -0600

csiph-web