Issue warning if no "return" in function?

alex23 wuwei23 at gmail.com
Thu Sep 4 22:08:49 EDT 2008


On Sep 4, 8:05 pm, Poster28 <usen... at anton.e4ward.com> wrote:
> What would you suggest to check python programs for non-syntax error.
> One example I could think of that one might forget to "return" a value from
> a function.
>
> How could I check for these and maybe other mistakes?

I really recommend getting into the habit of writing tests for all of
your programs. I like the test-driven approach; write a test that
reflects the behaviour you want and -then- write your code. If it
doesn't succeed, there's most likely something wrong with your code.

Test-Driven Development in Python:
http://www.onlamp.com/pub/a/python/2004/12/02/tdd_pyunit.html

nose (a very nice test runner):
http://code.google.com/p/python-nose/



More information about the Python-list mailing list