[Python-Dev] default of returning None hurts performance?
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Sep 2 00:04:46 CEST 2009
Xavier Morel wrote:
> I fail to grasp the unpredictability of "the last expression evaluated
> in the body of a function is its return value".
It's unpredictable in the sense that if you're writing
a function that's not intended to return a value, you're
not thinking about what the last call you make in the
function returns, so to a first approximation it's just
some random value.
I often write code that makes use of the fact that falling
off the end of a function returns None. This has been a
documented part of the Python language from the beginning,
and changing it would break a lot of code for no good
reason.
--
Greg
More information about the Python-Dev
mailing list