1
これらの2つが同じ結果を得るなぜ私は、次のコードリストまたは設定します(リスト)とのpythonセット更新に
l = [1, 2]
s = set()
# the same results from the following two
s.update(set(l))
s.update(l)
に遭遇しましたか?どちらもiterableなの?
Documentationこれらの2つが同じ結果を得るなぜ私は、次のコードリストまたは設定します(リスト)とのpythonセット更新に
l = [1, 2]
s = set()
# the same results from the following two
s.update(set(l))
s.update(l)
に遭遇しましたか?どちらもiterableなの?
Documentation:
注、更新の非オペレータバージョン()、intersection_update()、difference_update()およびsymmetric_difference_update()の引数として、任意の反復可能に受け入れます。