[Tutor] What's in a name?

Keith Winston keithwins at gmail.com
Fri Jan 3 06:22:17 CET 2014


I've got the beginner's version of a question I think Denis asked
recently...

If I'm iterating a variable through a series of list names, for future
processing, I would like to print the name of the list the variable is set
to in a given moment... i.e.

for i in [alist, blist, clist]
    i[3] = "okey dokey "
    print(i[3], i.name)  # this is definitely not the way to do it...

output:
okey dokey alist
okey dokey blist
okey dokey clist

Is there any way to do that? I'm thinking there may not be, since the
variable is actually bound to the content of the list, not the other
name... which would be good, in the sense that I'm beginning to understand,
but bad in the sense that I need to rethink a piece (or two) of code.
-- 
Keith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140103/f002cec8/attachment.html>


More information about the Tutor mailing list