> There is a ready made and well tested lazy decorator at
> http://pypi.python.org/pypi/lazy. I even has a better name. ;-)
I was ignorantly unaware of this module. You've saved me a few lines of code
every time I want to achieve lazy loading - thanks :)
> Since people seem to come up with the
On 16.11.2012, at 11:54, Andriy Kornatskyy wrote:
>> Subject: Re: Lazy Attribute
>> From: ste...@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:
>>
>>>
On 15.11.2012, at 20:33, Andriy Kornatskyy wrote:
> A lazy attribute is an attribute that is calculated on demand and only once.
>
> The post below shows how you can use lazy attribute in your Python class:
>
> http://mindref.blogspot.com/2012/11/python-lazy-attribute.html
>
> Comments or sugge
> From: steve+comp.lang.pyt...@pearwood.info
> Subject: Re: Lazy Attribute
> Date: Fri, 16 Nov 2012 10:29:03 +
> To: python-list@python.org
>
> On Thu, 15 Nov 2012 15:46:19 -0700, Ian Kelly wrote:
>
> > Although you don't go into it in the bl
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/lates
On Thu, 15 Nov 2012 15:46:19 -0700, Ian Kelly wrote:
> Although you don't go into it in the blog entry, what I like about your
> approach of replacing the descriptor with an attribute is that, in
> addition to being faster, it makes it easy to force the object to lazily
> reevaluate the attribute,
This is very minor use case. Unlikely useful to add any checks for None, or
translate one exception to the other... with pretty much the same outcome: it
makes sense in objects only.
Thanks.
Andriy
> From: rousl...@msn.com
> Subject: Re
Same applies to properties... they are seen as an object attributes.
Thanks.
Andriy
> From: steve+comp.lang.pyt...@pearwood.info
> Subject: Re: Lazy Attribute
> Date: Fri, 16 Nov 2012 09:04:39 +
> To: python-list@python.org
>
> O
from wheezy.core.descriptors import attribute as lazy
@lazy
def display_name...
Thanks.
Andriy Kornatskyy
> Date: Fri, 16 Nov 2012 09:56:41 +0200
> From: s...@mweb.co.za
> To: python-list@python.org
> Subject: Re: Lazy Attribute
>
>
On 11/16/2012 04:32 AM, Rouslan Korneychuk wrote:
On 11/16/2012 02:49 AM, Andriy Kornatskyy wrote:
If accessing the descriptor on the class object has no special
meaning, then the custom is to return the descriptor object itself, as
properties do.
If I would satisfy this, I will be forced to c
On 11/16/2012 02:49 AM, Andriy Kornatskyy wrote:
If accessing the descriptor on the class object has no special
meaning, then the custom is to return the descriptor object itself, as
properties do.
If I would satisfy this, I will be forced to check for None 99.9% of the use
cases (it is not No
On Fri, 16 Nov 2012 10:49:07 +0300, Andriy Kornatskyy wrote:
> Ian,
>
> Thank you for the comments.
>
>> The name "attribute" is not very descriptive. Why not "lazy_attribute"
>> instead?
>
> It just shorter and still descriptive.
It is not descriptive. EVERYTHING accessed used dot notation ob
On 2012/11/16 09:49 AM, Andriy Kornatskyy wrote:
The name "attribute" is not very descriptive. Why not "lazy_attribute" instead?
It just shorter and still descriptive.
Shorter, but not descriptive.
--
Regards
Alex
--
http://mail.python.org/mailman/listinfo/python-list
Ian,
Thank you for mentioning about this research, really appreciate that.
Thanks.
Andriy Kornatskyy
> From: ian.g.ke...@gmail.com
> Date: Thu, 15 Nov 2012 15:46:19 -0700
> Subject: Re: Lazy Attribute
> To: python-list@python.org
>
&
(it is not None, being applied to an object). Thus it behaves as designed.
Thanks.
Andriy Kornatskyy
> From: ian.g.ke...@gmail.com
> Date: Thu, 15 Nov 2012 15:24:40 -0700
> Subject: Re: Lazy Attribute
> To: python-list@python.org
>
>
On Thu, Nov 15, 2012 at 12:33 PM, Andriy Kornatskyy
wrote:
>
> A lazy attribute is an attribute that is calculated on demand and only once.
>
> The post below shows how you can use lazy attribute in your Python class:
>
> http://mindref.blogspot.com/2012/11/python-lazy-attribute.html
>
> Comments
On Thu, Nov 15, 2012 at 12:33 PM, Andriy Kornatskyy
wrote:
>
> A lazy attribute is an attribute that is calculated on demand and only once.
>
> The post below shows how you can use lazy attribute in your Python class:
>
> http://mindref.blogspot.com/2012/11/python-lazy-attribute.html
>
> Comments
17 matches
Mail list logo