a question about "return"
Grant Edwards
grante at visi.com
Tue Jul 4 01:38:06 EDT 2006
On 2006-07-04, yaru22 <yaru22 at gmail.com> wrote:
> What does it mean to have nothing after return?
It means to return None.
> Why do we even include "return" if we are not putting any
> value after?
If it's the last statement in the function, you don't need it.
Some people do it just as a formal indicate that that's the end
of the function.
OTOH, sometimes people want to return explicitly from somewhere
within the function:
def foo(x):
if x<0:
return
else:
whatever
--
Grant Edwards grante Yow! Two with FLUFFO,
at hold th' BEETS...side of
visi.com SOYETTES!
More information about the Python-list
mailing list