Python: Reading a global variable inside a function creator
Question: So, I want to create a function creator that reads a global variable every
time it's called, and not just when it's created. That's not the case, since
Python replaces my var reference with it's current value.

    
    
    import operator
    
    space = []
    pp = 0 #this is a global var
    
    def op(op,*tval,over = 0, doSave = True):
         def operation():
            val = list(tval)
            val.append(space[pp]) # This apparently becomes val.append(space[0])
            temp = op(*val)
            if doSave:
                     space[pp] = temp # This apparently becomes space[0] = temp
         return operation
    
    increase = op(operator.add, 1, doSave = True)
    

Increase only works with space[0] and even if I change pp, it only modifies
the first value of space.


Answer: 
    return operation
    

should be indented.

You should have

    
    
    global space
    

to change `space`.

