Menu

#9 Pychecker sometimes thinks a function returns None when it doesn't.

v1.0 (example)
open
nobody
None
5
2014-02-21
2014-02-21
No

Pychecker thinks I have a function that returns None, but it returns a list. I saw a similar problem with a dict, but this is the simplest version I could send.

I'm on a Macbook Air running Mavericks in terminal, with pychecker 0.8.19 and python 2.7

will@will-macbook-air:~/temp$ pychecker test.py
Processing module test (test.py)...

Warnings...

test.py:4: Local variable (i) not used
test.py:8: Using the return value from (chars) which is always None
will@will-macbook-air:~/temp$ more test.py

!/usr/bin/env python

def chars():
return ''.join(['a' for i in xrange(2)])

def main():
x = chars()
print x

if name == 'main':
main()
will@will-macbook-air:~/temp$ ./test.py
aa
will@will-macbook-air:~/temp$

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.