What makes python decide whether a particular variable is global or local? I've got a list and a integer, both defined at top level, no indentation, right next to each other:
allThings = [] nextID = 0 and yet, in the middle of a function, python sees one and doesn't see the other: class ship(thing): ###snip### def step(self): ###snip### if keys[K_up] for n in range(0,2): #sparks/newton second is proportional to framerate divergence = 5.0 p = self.body.getRelPointPos((-0.15,0,0)) v = self.body.vectorToWorld((-100+ random.uniform(- divergence,divergence) ,random.uniform(-divergence,divergence),0)) allThings.append(particle(p,v)) allThings[len(allThings)-1].id = nextID nextID += 1 I don't think it's important, but the function is defined before the two globals. What gives? -- http://mail.python.org/mailman/listinfo/python-list