On 03/01/2014 05:22, Keith Winston wrote:
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 <http://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


I don't understand what you're asking for. It doesn't help that the code you've posted isn't even valid. If you add the missing colon at the end of the for loop, you've still got a problem in that standard lists don't have a name attribute.

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to