Use a more functional style. Tidy up re pylint.

- Create a decorator which turns a simple completer function into one which
  uses readline's simplistic "state" protocol. This allow the function to
  return an iterable, which is more efficient.
- Use list comprehensions instead of for loops where possible.
- Tidy up spaces and function names.