return None
Erik Max Francis
max at alcyone.com
Sat Jul 23 03:35:15 EDT 2005
Grant Edwards wrote:
> Personally, I don't really like the idea that falling off the
> botton of a function implicitly returns None. It's just not
> explicit enough for me. My preference would be that if the
> function didn't execute a "return" statement, then it didn't
> return anyting and attempting to use a return value would be an
> error.
That's not a bad idea. I tend to prefer self-documenting code whenever
possible anyway, so if I a method ends that I don't intend to have a
useful return value, I don't have a return statement with an argument,
and if I intend a method that returns a useful value to return one that
might be None, I do so expliclitly, rather than having the logic fall
off the end of the function, making it unclear what was intended in the
first place.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
Grab a club and join the chorus / Evolution is a state of mind
-- Oleta Adams
More information about the Python-list
mailing list