Re: floatref

2010-07-15 Thread Tino Wildenhain
Hi John, Am 15.07.2010 09:14, schrieb John Nagle: On 7/14/2010 12:56 AM, Roald de Vries wrote: I know, I just wondered if there is a *standard* solution. Yes, there is. class floatref(object) : def __init__(self, initialval) : self.__dict__["_val"] = initialval def __getattr__(self, attrname

Re: floatref

2010-07-15 Thread John Nagle
On 7/14/2010 12:56 AM, Roald de Vries wrote: I know, I just wondered if there is a *standard* solution. Yes, there is. class floatref(object) : def __init__(self, initialval) : self.__dict__["_val"] = initialval def __getattr__(self, attrname) : if attrname == 'val' :

Re: floatref

2010-07-14 Thread Tino Wildenhain
Am 13.07.2010 19:26, schrieb Roald de Vries: > 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

Re: floatref

2010-07-14 Thread Christian Heimes
> I know, I just wondered if there is a *standard* solution. Yeah, you have to reset your brain and switch to Python mode. *scnr* Seriously, your inquiry sounds like you are trying to code C in Python. I'm using Python for more than seven years and I've never felt the need for a mutable float ref

Re: floatref

2010-07-14 Thread Roald de Vries
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 somet

Re: floatref

2010-07-14 Thread Roald de Vries
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 somet

Re: floatref

2010-07-14 Thread Roald de Vries
On Jul 14, 2010, at 1:26 AM, Gary Herron wrote: On 07/13/2010 03:02 PM, Roald de Vries wrote: Hi Gary, On Jul 13, 2010, at 8:54 PM, Gary Herron wrote: On 07/13/2010 10:26 AM, Roald de Vries wrote: Hi all, I have two objects that should both be able to alter a shared float. So i need someth

Re: floatref

2010-07-13 Thread Steven D'Aprano
On Wed, 14 Jul 2010 06:50:58 +0200, Alf P. Steinbach /Usenet wrote: > Possibly you have a point here. Oh yeah? Don't think you can escape a flame war by agreeing with me! *wink* -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: floatref

2010-07-13 Thread Alf P. Steinbach /Usenet
* Steven D'Aprano, on 14.07.2010 06:31: Gary did the right thing by pointing out that the simple-sounding term "points to" is anything but simple, it depends on what you mean by pointing and pointers. Possibly you have a point here. Cheers, - Alf -- blog at http://alfps.wordpress.com> -- h

Re: floatref

2010-07-13 Thread Steven D'Aprano
On Wed, 14 Jul 2010 03:19:36 +0200, Alf P. Steinbach /Usenet wrote: > Gary Herron wrote: >> Python does not have pointers, so if I take your wording"y.var and >> x.var to point to the same value" literally, then the answer is NO >> Python does not do that. > > This is just a terminological issue.

Re: floatref

2010-07-13 Thread Steven D'Aprano
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

Re: floatref

2010-07-13 Thread Alf P. Steinbach /Usenet
* Gary Herron, on 14.07.2010 01:26: On 07/13/2010 03:02 PM, Roald de Vries wrote: Hi Gary, On Jul 13, 2010, at 8:54 PM, Gary Herron wrote: On 07/13/2010 10:26 AM, 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 mut

Re: floatref

2010-07-13 Thread Gary Herron
On 07/13/2010 03:02 PM, Roald de Vries wrote: Hi Gary, On Jul 13, 2010, at 8:54 PM, Gary Herron wrote: On 07/13/2010 10:26 AM, 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 referen

Re: floatref

2010-07-13 Thread Gary Herron
On 07/13/2010 10:26 AM, 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