Add support for PyLint and fix warnings and errors it flagged

PyLint (www.pylint.org) is a static code checker for Python. I made a rather liberal configuration, to avoid the useful warnings getting lost among tons of less useful ones.

Most of the things it found are opportunities to clean up the code, but it found a few bugs as well. I didn't have time to examine all things it reported yet.