documentation / reference help

Chris Rebert clp2 at rebertia.com
Sun Jan 23 15:18:35 EST 2011


On Sun, Jan 23, 2011 at 11:52 AM, CM <cmpython at gmail.com> wrote:
> 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).

Pedantic nitpick:
Technically it does; you're just not required to always explicitly provide one.
Python uses None if you don't specify anything
    (i.e. a bare `return` === `return None`).
By definition, every function returns *some* value.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list