# Iterator to list This [[Anti-Pattern]] happens when an [[Iterator]] is converted to a list without good reason, leading to an unnecessary increase of [[verbosity]] and a misleading [[semantic]]. ```python # Don’t numbers = list(map(int, input().split())) even_numbers = [n for n in numbers if n % 2 == 0] # Do numbers = map(int, input().split()) # No need for a list, map is enough even_numbers = [n for n in numbers if n % 2 == 0] ``` ## Why it happens People not used to iterators tend to convert them to another type as soon as possible, generally into a list. Doing so, they don’t have to worry about [[Iterator#Exhaustion|iterator exhaustion]], it make the debugging process easier and allows to [[print]] the list content without thinking about it. ## Consequences The worst consequence of this is the misleading meaning it carries for other developers who will read the code. For the --- Bibliography: - [Title - website.com](need bibliography)