There have been complains, both gentle and otherwise, about Leo's style. I'm not likely to forget them.
A completely new (for me) style has emerged while working on the keys2 branch. Its main features:
1. I have removed almost all trace statements from complex methods. I had no idea that these we having such a harmful effect on the code. I thank Vitalije for this. It's big.
2. Guided by pylint warning (still disabled) about 'else' statements following a 'return', I have "flattened" the code in several places. The result is, to my eyes, simpler and clearer.
3. I have refactored k.masterKeyHandler and filter.toBinding using as many helper methods as possible. This has eliminated quite evil section references and drastically clarified the code.
4. At the top level of methods, I now use comments formatted like this:
#
# My comment
code
This may seem like a small thing, but it highlights important comments to a surprising degree. The empty '#' line also makes such comments immune from Leo's beautify command.
Summary
If you doubt the effectiveness of these improvements, just compare the old and new versions of the eventFilter and masterKeyHandler methods and their respective helpers.
I'll transition to the improved style gradually as I encounter code to be revised for other reasons.
Edward