Python __hash__ return value - what use is it?

2026-06-01 Thread Veek M
1. So I am returning 1 for every instance of MyClass and then inserting the instances into a set. However when I print the set I see individual instances though I want the instances to be the treated the same .ie there should be just one instance in the set because the return value from __hash_

Re: Python __hash__ return value - what use is it?

2026-06-01 Thread Veek M
On Sun, 31 May 2026 09:25:32 - (UTC), Lawrence D’Oliveiro wrote: > On Sun, 31 May 2026 08:28:46 - (UTC), Veek M wrote: > >> However when I print the set I see individual instances though I want >> the instances to be the treated the same .ie there should be just one >> instance in the set

Re: Python __hash__ return value - what use is it?

2026-06-01 Thread Jon Ribbens via Python-list
On 2026-05-31, Veek M wrote: > 1. So I am returning 1 for every instance of MyClass and then inserting > the instances into a set. However when I print the set I see individual > instances though I want the instances to be the treated the same .ie there > should be just one instance in the set