[Tutor] How to do call by reference (or equiv.) in Py?

Aztech Guy aztech1200@yahoo.com
Fri Nov 22 16:09:22 2002


--0-2126290184-1037999258=:97513
Content-Type: text/plain; charset=us-ascii


Hi fellow Pythonistas,

I have a C background - but am a Py newbie ...

Using ActiveState Py 2.2.1 on Win.

How does one do call by reference in Python ? I.e. pass a variable by reference ? Or is it not possible at all ? Does that mean that I'd have to simulate the effect by using "return" ?

I took a look (somewhat cursory, I'll admit - no flames, please - skimmed the TOC's and read the links for likely-looking sections)  at both the Py Tutorial and the Language Reference - but could not find any info on how to pass a var by ref to a fn., so that when the called fn. returns, whatever change it has made to the var, persists, i.e. the change is visible in the calling fn.

TIA

Az

 



---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now
--0-2126290184-1037999258=:97513
Content-Type: text/html; charset=us-ascii

<P>Hi fellow Pythonistas,</P>
<P>I have a C background - but am&nbsp;a Py newbie ...</P>
<P>Using ActiveState Py 2.2.1 on Win.</P>
<P>How does one do call by reference in Python ? I.e. pass a variable by reference ? Or is it not possible at all ? Does that mean that I'd have to simulate the effect by using "return" ?</P>
<P>I took a look (somewhat cursory, I'll admit - no flames, please - skimmed the TOC's and read the links for likely-looking sections) &nbsp;at both the Py Tutorial and the Language Reference - but could not find any info on how to pass a var by ref to a fn., so that when the called fn. returns, whatever change it has made to the var, persists, i.e.&nbsp;the change is visible in the calling fn.</P>
<P>TIA</P>
<P>Az</P>
<P>&nbsp;</P><p><br><hr size=1>Do you Yahoo!?<br>
<a href="http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com">Yahoo! Mail Plus</a> - Powerful. Affordable. <a href="http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com">Sign up now</a>
--0-2126290184-1037999258=:97513--