documentation / reference help

CM cmpython at gmail.com
Sun Jan 23 14:52:13 EST 2011


On Jan 23, 2:38 pm, "Littlefield, Tyler" <ty... at tysdomain.com> wrote:
> 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.

And return doesn't have to return a value(s).  It can just cause the
program's execution to not proceed further but to go back
to the calling function, like:

def checkAplusB(a, b):
    if a + b > 5:
        return


>
> 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




More information about the Python-list mailing list