paul at prescod.net
Sat Aug 28 12:06:36 CEST 1999
Tim Peters wrote:
> > Personally, I think falling out of functions and expecting None to be
> > implicitly returned is a very Perl-ish thing to do...
> Oddly enough not. In the absence of an explicit "return", Perl returns the
> value of the last expression evaluated before falling off the end, so in your
> function above it returns what you intended.
It's Perl-ish in that it is trying to guess what you meant.
> Python doesn't return None for the convenience of people too lazy to explicitly
> return None themselves; it's instead a cheap way to make it probable that
> someone using a procedure as a function will get an error (None supports no
> operations except true/false interpretation) without blowing up the interpreter
> (do this in C and you'll access random stack trash).
I'm not clear what you are trying to say here. Explicitly triggering a
runtime error would not blow up the interpreter.
More information about the Python-list