floatref

Roald de Vries downaold at gmail.com
Wed Jul 14 04:32:37 EDT 2010


On Jul 14, 2010, at 3:53 AM, Steven D'Aprano wrote:
> On Tue, 13 Jul 2010 19:26:34 +0200, Roald de Vries wrote:
>
>> Hi all,
>>
>> I have two objects that should both be able to alter a shared  
>> float. So
>> i need something like a mutable float object, or a float reference
>> object. Does anybody know if something like that exists? I know  
>> it's not
>> hard to build, but I have a feeling that there should be a standard
>> solution to it.
>
> One standard solution would be to wrap the float in a class as an
> attribute.

I think the nicest solution is to do this with a wrapping descriptor  
class.

Thanks for your input!

Cheers, Roald




More information about the Python-list mailing list