Printing using list comprehension

A list comprehension is not the right tool for the job at hand. It'll always return a list, and given that print() evaluates to None, the list is filled with None values. A simple for loop works better when we're not interested in creating a list of values, only in evaluating a function with no returned value:

for x in numbers:
    print(x)

You should restructure your loop to send arguments to print():

>>> numbers = [1,2,3]
>>> print(*(x for x in numbers), sep='\n')

Note that you don't need the explicit generator. Just unpack the list itself:

>>> numbers = [1,2,3]
>>> print(*numbers, sep='\n')

Tags:

Python