Unexpected Behavior of Extend with a list in Python [duplicate]
This question already has an answer here: Why does list.append evaluate to false in a boolean context? [duplicate] 7 answers I am trying to understand how extend works in Python and it is not quite doing what I would expect. For instance: >>> a = [1, 2, 3] >>> b = [4, 5, 6].extend(a) >>> b >>> But I would have expected: [4, 5, 6, 1, 2, 3] Why is that returning a None instead of extending the list? The extend() method appends to the existing array and returns None . In your case, you are creating an array — [4, 5, 6] — on the fly, extending it and then discarding it. The variable b ends up with