[Tutor] Possible to change values of scalar function parameters?

Alan Gauld alan.gauld at btinternet.com
Tue Feb 17 19:46:36 CET 2009


<python at bdurham.com> wrote

>> No, not a simple way at least. Possibly you can do it with hackery
> involving stack frames but I wouldn't recommend that. Either pass 
> the
> values in some kind of container (list, dict, class instance) or
> return the new value and assign it in the caller.
>
> That's what I thought. Thank you!

But don't forget that in python you can return multiple values
from a function...

def f():
     return 42, 66, 101

a,b,c = f()

HTH,

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list