Soon to be an outdated diff, but I don't like the `not len(x)` idiom.  In the pure Python world people will scream at `if len(my_list) == 0:` and say you should use `if not my_list:`.  Maybe, maybe not, but in any case in our world where we interchangeably deal with lists and numpy arrays (which as you well know do not support boolean casting), the`len(my_list) == 0` test is more explicit and matches exactly what you *mean*.