The below code is not acting as expected for me.
class stateClass:
state = 0
states = []
states.append(stateClass)
states.append(stateClass)
def populateStates(states):
for s in states:
if s.state == 0
print 'populating'
s.state = 1
populateStates(states)
the output is
states array length: 2
populating
this is failing the second time
for s in states:
if s.state == 0
if conditional is failing the second time although it is a different index in the array and thus the s.state should have been initialized to 0. So I think the loop is not iterating properly.
Anyone know whats wrong?