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

What's wrong with:

def foo(n):
    return 7

def main():
    n = 4
    n = foo(n)
    print n

Anything else (including the tricks involving mutable objects that will
no doubt be posted) will result in ugly, hard to maintain code.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to