Returning none

Alexander Williams thantos at brimstone.mecha
Sat Aug 28 21:45:01 CEST 1999


On Sat, 28 Aug 1999 07:08:05 GMT, C.Laurence Gonsalves
<clgonsal at keeshah.penguinpowered.com> wrote:

>I really *would* like to see a stronger distinction between procedures
>and functions though. I really don't think it's right for a Python

Actually, I have a solution to this that requires absolutely no code
changes, merely a perceptual change; to wit:

There are no procedures in Python.  There are only function calls (and
Zuul).

The hinge-point for understanding is that Python defines a /default/
return value for every function which is returned if there is no
explicit return; in the case of Python this value is "None".  Seen
from this perspective, you can complain about the default value for
function returns and at least be conceptually accurate but can no
longer drag a false distinction between function and procedure into
the mix.

For my part, I rather like None being the default function return
value; this lets me /treat/ a function as a procedure invisibly and
get on with things more important than jiggering with syntax, namely,
solving the problem at hand.

-- 
Alexander Williams (thantos at gw.total-web.net)
"In the end ... Oblivion Always Wins."




More information about the Python-list mailing list