Jul-08-2019, 05:36 PM
(Jul-08-2019, 05:30 PM)Shivesh Wrote: Note : I am not appending anything to my original variables tempPath or allPaths[a][0].
Yes you are. Lists are mutable, so when you assign a variable name to one, you are assigning a pointer to the list. When you do path = tempPath, you are just reassigning that pointer, you are not making an independent copy of the list. To make a copy, you need to do path = tempPath[:] (a full slice of the list). Note that this makes a shallow copy of the list, so any sub-lists in the list will not get copied. But it looks like your lists are all tuples (which are immutable), so that shouldn't be a problem.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures