__hash__ and ordered vs. unordered collections

Josh B. jabronson at gmail.com
Mon Nov 20 14:52:59 EST 2017


On Monday, November 20, 2017 at 2:31:40 PM UTC-5, MRAB wrote:
> What if there are duplicate elements?
> 
> Should that be MyColl(some_elements) == MyOrderedColl(other_elements) 
> iff len(some_elements) == len(other_elements) and set(some_elements) == 
> set(other_elements)?

Yes, that's what I meant. Thanks for catching :)

Please let me know if you have any thoughts on how you would design our hypothetical frozen(ordered)set library to behave in these cases.



More information about the Python-list mailing list