Why does list.append() return None? [duplicate]

Just replace a_list = a_list.append(r) with a_list.append(r).

Most functions, methods that change the items of sequence/mapping does return None: list.sort, list.append, dict.clear

Not directly related, but see Why doesn’t list.sort() return the sorted list?.

Leave a Comment