On Tue, Feb 17, 2009 at 11:57 AM,  <pyt...@bdurham.com> wrote:
> Is there a way to change values of scalar function parameters? I know you
> can change the values of parameters if the parameter is a mutable type like
> a list, but is there a way to update the value of scalar parameters of type
> integer or string?
>
> Simple example: Is there a way to have the following function update its
> changeme parameter in a 'call by reference' manner?
>
>>>> def test1( changeme ):
>     changeme = 'Changed!'

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.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to