"Elliot Temple" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I want to write a function, foo, so the following works: > > def main(): > n = 4 > foo(n) > print n > > #it prints 7 > > if foo needs to take different arguments, that'd be alright. > > Is this possible?
No, you cannot *rebind* in intermediate scopes. However you can alter. nl = [4] foo(nl( print nl[0] #could print anything Or pass dict or instance Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list