[Tutor] What's in a name?

Keith Winston keithwins at gmail.com
Fri Jan 3 06:29:34 CET 2014


Hmm, maybe I stumbled upon at least one approach, turning the problem
around. Make it something like:

for i in ["alist", "blist", "clist"]
    i[3] = "okey dokey "
    print(eval(i)[3], i)

Of course I've been staring at this for a while, but as soon as I post I
find a way... this is my first use of eval(), so it took me a while to
stumble upon it. If there are more elegant solutions, I'm all ears.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140103/35f5d991/attachment.html>


More information about the Tutor mailing list