Python extend with an empty list bug? [duplicate]
问题 This question already has answers here : Why does list.append evaluate to false in a boolean context? [duplicate] (7 answers) Closed 3 years ago . Why does python 2.5.2 have the following behavior >>>[2].extend([]) == [2] False >>> [2].extend([]) == None True $ python --version Python 2.5.2 I assume I\'m not understanding something here, but intuitively I\'d think that [2].extend([]) should yield [2] 回答1: Extend is a method of list, which modifies it but doesn't return self (returning None