I am not understanding the behavior that Python is giving me in the following:
>>> adj = gx.g.neighbors('v') >>> adj ['x', 'w'] >>> gx.d['x'] [13, 14, 'black', 'v'] >>> gx.d['w'] [9, 333, 'black', 'v'] >>> for x in adj: #for every element in the list ... print "x", x, gx.d[x] ... print "color", gx.d[x][2] ... if gx.d[x][2] != 'white': ... adj.remove(x) ... x x [13, 14, 'black', 'v'] color black >>> adj ['w'] What I do not understand is why it appears that only the element 'x' gets printed in the loop. What happened to 'w'. The output of the algorithm segment should be an empty list as both elements of adj are black.