"Caleb Hattingh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi It's me
>
> >
> >     a = 3
> >     y = "a"
> >     print eval(y)
> >
>
> To get 'a' to be 4 here, you would say
>
> a = 4
>

Obviously but that's not what I wish to do.

> I am not sure why you would want to do otherwise?  Perhaps you could
> sketch out a little more about what you are trying to do?  That would help
> a lot.  Are you aiming for something like pointer emulation with simple
> datatypes?
>

In REXX, for instance, one can do a:

    interpret y' = 4'

Since y contains a, then the above statement amongs to:

    a = 4

There are many situations where this is useful.   For instance, you might be
getting an input which is a string representing the name of a variable and
you wish to evaluate the expression (like a calculator application, for
instance).


> Thanks
> Caleb


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to