> On Mar 23, 2020, at 16:57, Steven D'Aprano <st...@pearwood.info> wrote: > > I shouldn't need to say this, but for the record I am not proposing and > do not want set equality to support lists; nor do I see the need for a > new method to perform "equivalent to equality" tests; but if the > consensus is that sets should have that method, I would prefer it to be > given the simpler name: > > set.superset # not .equivalent_to_superset > set.subset # not .equivalent_to_subset > set.equals # not some variation of .equivalent_to_equals
The existing methods are named issubset and issuperset (and isdisjoint, which doesn’t have an operator near-equivalent). Given that, would you still want equals instead of isequal or something? Personally, I don’t like the idea of an “equals” method. Maybe it’s just Scheme/Smalltalk/ObjC/Ruby/etc. flashbacks, but a builtin type having an equals method that’s different from the == operator makes me expect some horrible convention where all types have two or more ways to check different notions of equality, and generally == is stricter than eq is stricter than eql is stricter than equals (although IIRC it’s the other way round in Ruby?), but every time you read any comparison you have to go look at the type’s help to see exactly what “stricter” means for that type. So, I’d rather have an uglier, more explicit, and more obviously specific-to-set name like iscoextensive. Sure, not everyone will know what “coextensive” means, but people who don’t know will not have any use for a method that means “compare these things for equality as if they were sets even though they may not be sets” in the first place. Of course that’s assuming _anyone_ has a need for this method, and I suspect you’re right that it’s rare enough (and easy enough to work around) that we don’t need to add anything in the first place. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ZYH7TQ4CGBOASDBPQZXJROAU25IXQZIA/ Code of Conduct: http://python.org/psf/codeofconduct/