"gangesmaster" <[EMAIL PROTECTED]> wrote:

> what problem does the cell object solve? 

The closure represents the variable, not the object. So if x is rebound to 
a different object your inner function g() will now access the new object. 
If the object itself was passed to MAKE_CLOSURE then g would only ever see 
the value of x from the instant when g was defined.

>>> def f(x):
    def g():
        print "x is", x
    g()
    x += 1
    g()

        
>>> f(1)
x is 1
x is 2

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

Reply via email to