"Normally a filter() call is equivalent to a list comprehension. I would have to go back and study the completion code again to see why I needed to deal with an empty text value. Perhaps it is passed as None sometimes? I think that whole expression could be shortened to [ f for f in self.FRIENDS i f.startswith(text or '')]. On the other hand, I'm not sure that's as clear as the explicit test outside of the comprehension for someone who is not used to evaluating complex expressions and my goal is to make all of the code here as bluntly clear as possible."
- Doug Hellmann