Your example could do with some syntax highlighting. There's so much ugly punctuation in it I didn't even notice the actual code at the end. Plus my first impression was that I would never put something so unreadable in my source, whereas in a nice green comment I wouldn't care so much.
In Java I solved the problem of whitespace by just running my result through google-java-format, but I see how Python's offside rule would make that totally impossible.