list of lists?? please help

Tom Kerrigan Thomas.Kerrigan at Colorado.EDU
Tue Sep 26 22:23:08 EDT 2000


Okay, I'll admit up front that this is a homework problem. Moreover, the
homework is due tomorrow, so I would really appreciate quick responses.
(Perhaps via e-mail?) Thanks guys. :)

I have two lists, state and node. I want node to be a list of states. State
is a list itself. The problem is that when I try to add state to node, e.g.,

node.append(state)

it only adds a pointer to state. This defeats my goal, because I just end up
with a list containing the same thing over and over.

Does anyone have any suggestions?

I've thought about packing state into a tuple (sp?) and then adding it to
node, but I'm not 100% sure how to do it and I consider it a hack anyway. :(

-Tom





More information about the Python-list mailing list