Returning none
Gordon McMillan
gmcm at hypernet.com
Fri Sep 3 10:19:14 EDT 1999
C. Laurence Gonsalves wrote:
> Perhaps your programming style is different than mine. I know I've
> frequently run into situations where I've forgotten to actually
> return the result I calculated. Apparently others have as well. I'm
> also sure there is a lot of code that ignores return values. There's
> a way to add checking for this as well...
I won't pretend I've never been bitten by this, or that it's always
easy to track down. But when I learned Pascal (my 4th language, I
think), I found the distinction between functions and procedures to
be very tiresome. A dozen years later when I had to write PL/SQL, I
had the same reaction. It means that for almost every call I make, I
have to remember or look up whether it's a function or a procedure.
I guess I have more sympathy for the functional style, though I find
the no side-effects restriction extreme. So Python's liberal rules
(side effects allowed) and consistency (everything returns a result,
whether desired or meaningful) are, to me, just dandy.
So put me firmly in the camp that favors a stronger PyLint (I just
recently got bit by a rarely used bare return in some released code).
- Gordon
More information about the Python-list
mailing list