Re: tracking variable value changes

2011-12-11 Thread alex23
Andrea Crotti andrea.crott...@gmail.com wrote: Not sure if it's exactly pure python but Traits can actually do thishttps://github.com/enthought/traits At an attribute level, absolutely, but not at the variable level like the OP is requesting. It's a great package, though :) --

Re: tracking variable value changes

2011-12-09 Thread Andrea Crotti
On 12/08/2011 08:17 PM, Catherine Moroney wrote: Hello, Is there a way to create a C-style pointer in (pure) Python so the following code will reflect the changes to the variable a in the dictionary x? For example: a = 1.0 b = 2.0 x = {a:a, b:b} x {'a': 1.0, 'b': 2.0} a = 100.0 x

Re: tracking variable value changes

2011-12-09 Thread Steven D'Aprano
On Thu, 08 Dec 2011 12:17:11 -0800, Catherine Moroney wrote: Hello, Is there a way to create a C-style pointer in (pure) Python so the following code will reflect the changes to the variable a in the dictionary x? Strictly speaking, no, but there may be a way to get something close. See

Re: tracking variable value changes

2011-12-08 Thread Jerry Hill
On Thu, Dec 8, 2011 at 3:17 PM, Catherine Moroney catherine.m.moro...@jpl.nasa.gov wrote: Is there some way to rewrite the code above so the change of a from 1.0 to 100.0 is reflected in the dictionary. I would like to use simple datatypes such as floats, rather than numpy arrays or classes.

Re: tracking variable value changes

2011-12-08 Thread Ian Kelly
On Thu, Dec 8, 2011 at 1:17 PM, Catherine Moroney catherine.m.moro...@jpl.nasa.gov wrote: Hello, Is there a way to create a C-style pointer in (pure) Python so the following code will reflect the changes to the variable a in the dictionary x? For example: a = 1.0 b = 2.0 x = {a:a, b:b}

Re: tracking variable value changes

2011-12-08 Thread Ben Finney
Catherine Moroney catherine.m.moro...@jpl.nasa.gov writes: Is there a way to create a C-style pointer in (pure) Python so the following code will reflect the changes to the variable a in the dictionary x? No, Python doesn't do pointers. Rather, objects have references and that's how the

Re: tracking variable value changes

2011-12-08 Thread Arnaud Delobelle
On 8 December 2011 21:50, Ian Kelly ian.g.ke...@gmail.com wrote: You can get the same effect with a float by putting it in a container object and binding both variables to the same container objects rather than to the float directly.  Then, to change the value, change the contents of the