reference help
documentation / reference help
Benjamin Kaplan benjamin.kaplan at case.eduTue Jan 25 13:32:48 EST 2011
- Previous message (by thread): documentation / reference help
- Next message (by thread): A and B but not C in list
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jan 25, 2011 1:19 PM, "Craig Leffel" <cralef at earthlink.net> wrote: > > Where does it return the value to? > > What do I need to put in the calling function so that I can use that value? > I need a variable name to refer to. Shouldn't I have to define that variable > someplace? > Python functions are like mathematical functions. The function call itself evaluates to a value (whatever is returned) which can be stored to a variable. y = f(x) You can even use the result without directly storing it in a variable. print f(g(x)) > "Littlefield, Tyler" <tyler at tysdomain.com> wrote in message > news:mailman.1103.1295811520.6505.python-list at python.org... > > The return value simply returns a value to the calling function, which the > > function can handle, however it wants. so: for example > > def add(a, b): > > return (a+b) > > > > That simply returns the value a+b, which you can use however you like, > > like so: i=add(2,3) will assign the return value to add. > > > > I recommend you check out the tutorial on python.org, which explains all > > of this; the documentation does not need updating, at least not in that > > respect. > > On 1/23/2011 11:41 AM, Scott Meup wrote: > >> I'm trying tolearn Python. The documentation tells syntax, and other > >> things > >> about a command. But for too many commands, it doesn't tell what it > >> does. > >> for instance, in VB the 'return' command tells the program what line to > >> execute after some event (usually an error). In Python it appears to > >> return > >> a value. Where does it return it to? I couldn't find anywhere on the > >> Python website to find out or to ask Python to upgrade their > >> documentation. > >> Can somebody please recommend a source. > >> > >> > > > > > > -- > > > > Thanks, > > Ty > > > > > > -- > http://mail.python.org/mailman/listinfo/python-list -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20110125/505be41e/attachment-0001.html>
- Previous message (by thread): documentation / reference help
- Next message (by thread): A and B but not C in list
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list