Appending to a list comprehension in Python returns None [duplicate]

append only works on variables, not list literals, since it updates the list object itself and does not return the resulting list.

As @Tomalak mentioned noted, running a similar operation on a simple list also returns None

>>> [1, 2, 3].append(4) == None
True

Leave a Comment