[Tutor] Scope and values in a list

Mallett, Roger rmallett@rational.com
Fri, 22 Dec 2000 16:18:23 -0800


I am having problems with a *for* loop picking up the *modified* value of a
list and would therefore like some to better understand SCOPE.

My basic problem is 


for n in myList:
	...
			then in a deeply nested *if*
				I modified the values of the list:  myList =
newList

The change to the list consists of eliminating some elements from the list

Looking at the STACK VIEW, I can observe the modifications taking place to
the list; however, when the loop comes back around and *n* is assigned a new
value it still seems to have access to the original list.


How might I make such changes?

(Note:  I don't seem to experience this problem when working in the
interactive window, but then again, I am not using such a deeply nested set
of statements.

Any help is greatly appreciated.


Roger Mallett