How do I do this? (eval() on the left hand side)
Erik Max Francis
max at alcyone.com
Tue Dec 7 16:23:59 EST 2004
It's me wrote:
> In REXX, for instance, one can do a:
>
> interpret y' = 4'
>
> Since y contains a, then the above statement amongs to:
>
> a = 4
The direct equivalent in Python would be
a = 3
y = 'a'
exec '%s = 4' % y
The better question would be whether or not this as useful as one might
thing in Python; if you find yourself doing this, often there are better
ways to accomplish the same thing, such as using dictionaries.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
But the system has no wisdom / The Devil split us in pairs
-- Public Enemy
More information about the Python-list
mailing list