Dun Peal wrote:
     # module foo.py
     var = 0

     def set():
         global var
         var = 1

My two cents to add in addition to the correct accounts of [ Daniel, Chris, Mel] is that you might have a misunderstanding of var, generally.

Python has no variables--- in the way you think of them in other languages. Python only has references.

Var is not 'set' in the classical sense of the word...

var is a 'reference' (think C pointer, sort-of) to an object... '0' and '1' are objects of type int and

var=0   means create a reference to object  int('0') called var.

a=b=0   a is a reference to object '0'
        b is a reference to object '0'

        a does not reference b

This rest of the discussion has to do with name spaces:

See:

http://docs.python.org/release/3.0.1/reference/datamodel.html?highlight=namespaces




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to