Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33434
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <stefan@epy.co.at> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'attribute': 0.05; '@property': 0.09; 'cached': 0.09; 'immutable': 0.09; 'objects.': 0.09; 'refresh': 0.09; ';-)': 0.11; 'anyway': 0.11; 'assume': 0.11; 'to:name:python-list': 0.15; 'advocating': 0.16; 'value:': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'mechanism': 0.17; 'stefan': 0.17; 'tests.': 0.17; 'handles': 0.18; 'solution.': 0.18; '>>>': 0.18; 'cc:2**0': 0.23; 'pass': 0.25; 'header:In- Reply-To:1': 0.25; '+0100': 0.27; 'reply.': 0.28; "d'aprano": 0.29; 'received:192.168.1.3': 0.29; 'steven': 0.29; 'date:': 0.29; "i'm": 0.29; 'fri,': 0.30; 'implement': 0.32; 'towards': 0.32; 'to:addr:python-list': 0.33; 'nov': 0.35; 'something': 0.35; 'subject:': 0.36; 'wanted': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'from:': 0.38; 'url:en': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Message-Id:1': 0.62; 'email name :python-list': 0.62; 'evaluate': 0.62; 'confirm': 0.64; 'decided': 0.65; 'received:at': 0.71; 'arise.': 0.84 |
| Subject | Re: Lazy Attribute |
| Mime-Version | 1.0 (Apple Message framework v1085) |
| Content-Type | text/plain; charset=us-ascii |
| From | "Stefan H. Holek" <stefan@epy.co.at> |
| In-Reply-To | <DUB117-W1382A140FEE822A755FE2C691510@phx.gbl> |
| Date | Fri, 16 Nov 2012 13:46:01 +0100 |
| Content-Transfer-Encoding | quoted-printable |
| References | <F1457CC9-913B-4437-A9C7-7775706DC592@epy.co.at> <DUB117-W1382A140FEE822A755FE2C691510@phx.gbl> |
| To | python-list <python-list@python.org> |
| X-Mailer | Apple Mail (2.1085) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3748.1353069963.27098.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1353069963 news.xs4all.nl 6880 [2001:888:2000:d::a6]:39239 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33434 |
Show key headers only | View raw
On 16.11.2012, at 11:54, Andriy Kornatskyy wrote: >> Subject: Re: Lazy Attribute >> From: stefan@epy.co.at >> Date: Fri, 16 Nov 2012 11:45:32 +0100 >> To: python-list@python.org >> >> On 16.11.2012, at 11:29, Steven D'Aprano wrote: >> >>> I'm very vaguely leaning towards this as the least-worst solution to >>> invalidating the cached value: >>> >>> refresh(obj, 'attr') # pass the instance and the name >> >> This it exactly how lazy handles invalidation. http://lazy.readthedocs.org/en/latest/ > > @property is a solution to evaluate something that is dynamic. @attribute is good for immutable objects. Even if we assume refresh is a good idea... how I would know when it is valid to `refresh`? What is criteria? > > Andriy I had to implement invalidation anyway in order to write tests. I decided to expose the mechanism to keep users from having to invent their own SHOULD the need arise. I was not advocating invalidation in any way with my reply. All I wanted was to confirm the "least bad" solution. ;-) Stefan -- Stefan H. Holek stefan@epy.co.at
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Lazy Attribute Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-15 15:46 -0700
Re: Lazy Attribute Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-16 10:29 +0000
Re: Lazy Attribute "Stefan H. Holek" <stefan@epy.co.at> - 2012-11-16 11:45 +0100
RE: Lazy Attribute Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-16 13:46 +0300
Re: Lazy Attribute "Stefan H. Holek" <stefan@epy.co.at> - 2012-11-16 13:46 +0100
csiph-web