Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Lazy Attribute

Reply
Thread Tools

Re: Lazy Attribute

 
 
Stefan H. Holek
Guest
Posts: n/a
 
      11-16-2012
On 16.11.2012, at 11:54, Andriy Kornatskyy wrote:

>> Subject: Re: Lazy Attribute
>> From: http://www.velocityreviews.com/forums/(E-Mail Removed)
>> Date: Fri, 16 Nov 2012 11:45:32 +0100
>> To: (E-Mail Removed)
>>
>> 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
(E-Mail Removed)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
lazy evaluation is sometimes too lazy... help please. Ken Pu Python 3 01-16-2009 11:23 AM
Re: lazy evaluation is sometimes too lazy... help please. Boris Borcic Python 0 01-16-2009 10:46 AM
Re: lazy evaluation is sometimes too lazy... help please. Boris Borcic Python 0 01-16-2009 10:37 AM
hello! first post to clr. I'm asking about an attempt at a lazy rubysolution to computing fibonacci numbers for a project euler problem. seems tobe a bug in lazy ruby... tphyahoo Ruby 6 08-08-2008 08:15 PM



Advertisments