Hi, I have the following code:
colorIndex = 0; def test(): print colorIndex; This won't work. But it works if i do this: colorIndex = 0; def test(): global colorIndex; print colorIndex; My question is why do I have to explicit declaring 'global' for 'colorIndex'? Can't python automatically looks in the global scope when i access 'colorIndex' in my function 'test()'? Thank you. -- http://mail.python.org/mailman/listinfo/python-list