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

python at bdurham.com python at bdurham.com
Tue Feb 17 17:57:25 CET 2009


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!'
>>> ref_value = 'blah'
>>> test1( ref_value )
>>> ref_value
'blah'
Thanks!
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090217/5754494c/attachment.htm>


More information about the Tutor mailing list