Why do the two scenarios below behave differently?
First:
x = []
[x.append('f8') for num in range(8)]
print(x)
Result:
['f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8']
Second:
x = []
print(list(x.append('f8') for num in range(8)))
Result:
[None, None, None, None, None, None, None, None]
Why is None
passed in the second case? How does list comprehension behave here?