#304 0.8.19: Wrong warning about "always None" return

0.8.19
open
nobody
None
5
2011-11-25
2011-11-25
kxroberto
No

0.8.19: The following nonsense warning about "always None" return is raised with the small minimized test file x.py below.
pychecker is to smart about this list comprehension in the return statement?
This error is not with 0.8.18

pychecker --only -#20 x.py
Processing module x (x.py)...
Warnings...
x.py:7: Using the return value from (clean) which is always None

#---------- file x.py
def clean(lst):
"strips off comments and empty lines"
return [x for x in lst if x.strip() and not x.startswith('#')]

def f():
lst = ['a','#b','c']
out = clean(lst)
print out

if __name__ == '__main__':
f()

#----------- runs ok
$ python x.py
['a', 'c']

If I change like

l = [x for x in lst if x.strip() and not x.startswith('#')]
return l

it will go through.

Discussion