2008-11-20から1日間の記事一覧
「==」は値の比較。 「is」はオブジェクトの比較。 >>> foo = 'Boys Be Ambitious' >>> bar = 'Boys Be Ambitious' >>> foo == bar True >>> foo is bar False 短い文字列など、使用頻度の高いオブジェクトは使い回されるので、 「is」での比較は True とな…
「==」は値の比較。 「is」はオブジェクトの比較。 >>> foo = 'Boys Be Ambitious' >>> bar = 'Boys Be Ambitious' >>> foo == bar True >>> foo is bar False 短い文字列など、使用頻度の高いオブジェクトは使い回されるので、 「is」での比較は True とな…