Bad programming style?
Gerrit Holl
gerrit.holl at pobox.com
Wed Dec 22 09:51:58 EST 1999
Sposhua wrote:
> I'm sure this is bad programming (though I'm sure I'll be proved wrong), but I'd
> like to know how to do it anyway...
Why do you need it?
> I want to create a varaible name and use it as a normal variable, something
> like:
>
> c=['r','g','b']
> VARIABLE_CALLED(c[0])='ff'
exec c[0] + '=' + '"ff"'
the 'exec' statement takes a string and executes it.
In this case, the string is:
'r="ff"'
I don't know if you already know this construction:
'%s="ff"' % d
regards,
Gerrit.
--
"However, complexity is not always the enemy."
-- Larry Wall (Open Sources, 1999 O'Reilly and Associates)
3:49pm up 4:44, 16 users, load average: 0.02, 0.01, 0.00
More information about the Python-list
mailing list