list of lists?? please help
David Goodger
dgoodger at bigfoot.com
Wed Sep 27 23:13:14 EDT 2000
More information about the Python-list mailing list
Wed Sep 27 23:13:14 EDT 2000
- Previous message (by thread): Crystal Space Python API??
- Next message (by thread): list of lists?? please help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
on 2000-09-26 22:23, Tom Kerrigan (Thomas.Kerrigan at Colorado.EDU) wrote: > 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. So you want to add a *copy* of state to node? Do: node.append(state[:]) You'll get the same thing over and over, as before, but each state is independently modifiable now. -- David Goodger dgoodger at bigfoot.com Open-source projects: - The Go Tools Project: http://gotools.sourceforge.net (more to come!)
- Previous message (by thread): Crystal Space Python API??
- Next message (by thread): list of lists?? please help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list