You might be able to avoid calling the method twice using the walrus operator.
I specifically discussed the walrus operator solution, but both you and Dominik Vilsmeier seem to have missed that.
I'd use the list constructor with a named function anyway, rather than inlining it in a comprehension. I consider that more readable.
I'm curious, how do you find this: def clean(): for line in lines: line = line.strip() if line: yield line clean_lines = list(clean()) more readable than this? clean_lines = [ for line in lines: line = line.strip() if line: yield line ] It's not that I find my version particularly readable, but I don't see how it's worse.