#22 Warn if lone function in condition not called

open
nobody
None
5
2004-10-02
2004-10-02
No

I had a function

def __valid( self ):
...

defined that I used in various if/while constructs as

while self.__valid():
...

but at one point I wrote

while self.__valid:
...

instead, which seems to be equivalent to True. I am not sure how this
will scale up to more complex conditions, i.e.

while self.__valid and self.__proper():
...

but I guess that should be checkable as well. Seems to me that if a
"callable" occurs in a condition, but no explicit comparison is
performed, that might be worth a warning. Not sure though, maybe I
missed something. Anyway, sure would have saved an hour of looking
if pychecker had found it. :-)

Discussion