Andrea Crotti 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 :)
--
http://mail.python.org/mailman/listinf
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
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}
On 8 December 2011 21:50, Ian Kelly 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 container object. Wha
Catherine Moroney 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 program accesses the objects.
On Thu, Dec 8, 2011 at 1: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}
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 cl
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
{'a': 1.0, 'b': 2.0} ## at