Extracting method to clarify non-intuitive list comprehension