<p><br>
On Jan 25, 2011 1:19 PM, "Craig Leffel" <<a href="mailto:cralef@earthlink.net">cralef@earthlink.net</a>> wrote:<br>
><br>
> Where does it return the value to?<br>
><br>
> What do I need to put in the calling function so that I can use that value?<br>
> I need a variable name to refer to. Shouldn't I have to define that variable<br>
> someplace?<br>
></p>
<p>Python functions are like mathematical functions. The function call itself evaluates to a value (whatever is returned) which can be stored to a variable. </p>
<p>y = f(x)</p>
<p>You can even use the result without directly storing it in a variable.</p>
<p>print f(g(x))<br><br><br></p>
<p>> "Littlefield, Tyler" <<a href="mailto:tyler@tysdomain.com">tyler@tysdomain.com</a>> wrote in message<br>
> news:mailman.1103.1295811520.6505.python-list@python.org...<br>
> > The return value simply returns a value to the calling function, which the<br>
> > function can handle, however it wants. so: for example<br>
> > def add(a, b):<br>
> >   return (a+b)<br>
> ><br>
> > That simply returns the value a+b, which you can use however you like,<br>
> > like so: i=add(2,3) will assign the return value to add.<br>
> ><br>
> > I recommend you check out the tutorial on <a href="http://python.org">python.org</a>, which explains all<br>
> > of this; the documentation does not need updating, at least not in that<br>
> > respect.<br>
> > On 1/23/2011 11:41 AM, Scott Meup wrote:<br>
> >> I'm trying tolearn Python.  The documentation tells syntax, and other<br>
> >> things<br>
> >> about a command.  But for too many commands, it doesn't tell what it<br>
> >> does.<br>
> >> for instance, in VB the 'return' command tells the program what line to<br>
> >> execute after some event (usually an error). In Python it appears to<br>
> >> return<br>
> >> a value.  Where does it return it to?  I couldn't find anywhere on the<br>
> >> Python website to find out or to ask Python to upgrade their<br>
> >> documentation.<br>
> >> Can somebody please recommend a source.<br>
> >><br>
> >><br>
> ><br>
> ><br>
> > --<br>
> ><br>
> > Thanks,<br>
> > Ty<br>
> ><br>
><br>
><br>
><br>
> --<br>
> <a href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list</a><br>
</p>