重複の可能性:
Python リスト拡張と変数割り当て
文字列の類似物が当てはまります。
string1 = 'abc'
''.join(string1) == string1 # True
では、なぜこれが当てはまらないのですか。
list1 = ['a', 'b', 'c']
[].extend(list1) == list1 # AttributeError: 'NoneType' object has no attribute 'extend'
type([])
リストを返します。拡張メソッドを持つリストではなく、NoneType として認識されるのはなぜですか?
これは学術的な質問です。これは通常のコードではありません。理解したいだけです。