Elliot Temple wrote: > 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?
It is possible if you pass mutable objects to foo such as lists or
dictionaries.
Is this what you are looking for?
def main():
d = [3,]
foo(d)
print d[0]
def foo(var):
var[0] = 7
main()
Cheers,
_Ron
--
http://mail.python.org/mailman/listinfo/python-list
