Bruno Desthuilliers wrote:
> Which is easy to do with properties too.
True enough. It's the caching of the return value that's the value add
of course. ;)
>
>> After
>> it is applied, then the penalties for function call of the property and
>> the computation are wiped out once the second acc
Rich Harkins a écrit :
> Bruno Desthuilliers wrote:
> [snip]
>
>>I'm sorry, but this looks like a very complicated way to do a simple thing:
>>
>>class MySimpleClass(object):
>> def __init__(self, x):
>> self.x = x
>> self.y = x ** 2
>>
>>
>
>
> Sure, for the absurdly simplified case I
Bruno Desthuilliers wrote:
> Rich Harkins a écrit :
>> [EMAIL PROTECTED] wrote:
>>> Hello everyone,
>>>
>>> I'm trying to do seemingly trivial thing with descriptors: have
>>> another attribute updated on dot access in object defined using
>>> descriptors.
>> [snip]
>>
>>> A setter function should
Bruno Desthuilliers wrote:
[snip]
> I'm sorry, but this looks like a very complicated way to do a simple thing:
>
> class MySimpleClass(object):
>def __init__(self, x):
> self.x = x
> self.y = x ** 2
>
>
Sure, for the absurdly simplified case I posed as an example. ;)
Here's ano
Rich Harkins a écrit :
> [EMAIL PROTECTED] wrote:
>> Hello everyone,
>>
>> I'm trying to do seemingly trivial thing with descriptors: have
>> another attribute updated on dot access in object defined using
>> descriptors.
>
> [snip]
>
>> A setter function should have updated self.l just like it u
[EMAIL PROTECTED] wrote:
> Hello everyone,
>
> I'm trying to do seemingly trivial thing with descriptors: have
> another attribute updated on dot access in object defined using
> descriptors.
[snip]
> A setter function should have updated self.l just like it updated
> self.s:
>
> def __se
[EMAIL PROTECTED] a écrit :
> Hello everyone,
>
> I'm trying to do seemingly trivial thing with descriptors: have
> another attribute updated on dot access in object defined using
> descriptors.
>
> For example, let's take a simple example where you set an attribute s
> to a string and have anoth
Hello everyone,
I'm trying to do seemingly trivial thing with descriptors: have
another attribute updated on dot access in object defined using
descriptors.
For example, let's take a simple example where you set an attribute s
to a string and have another attribute l set automatically to its
leng