Consider this >>> x=1 >>> def foo(): ... print x ... >>> def bar(): ... #print x <- referenced before assignment error ... x=2 ... print x ... >>> foo() 1 >>> bar() 2 >>> print x 1 >>> What rules in Python explain the scoping of x? Is there a name for the scope of the first x? 'module' scope? Why is bar() not able to access x but foo() can? Wai Yip Tung