At 2008-05-30T19:50:43Z, Cameron <[EMAIL PROTECTED]> writes: > Why does that work, but not this: > > def foo(n): > s = n > def bar(i): > s += i > return s > return bar
Assume that n is an int, making s one also. Ints are immutable; you can only copy them. So your bar is taking s, adding i to it, then assigning the value back to the local variable named s. -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list