On Fri, May 8, 2020, 6:39 PM Steven D'Aprano > So what? Why is this relevant? This is not a proposal for a generalised > equivalence relation. If you want one of those feel free to propose a > competing idea. >
The OP, with a certain degree of support from you, is asking for changing the meaning of an operator to enshrine one particular equivalence relation as syntactically blessed by the language. I note that that equivalence relation is not more important than numerous other equivalence relations, and hence should simply be a function returning a Boolean answer. I'm certain you understand this, I'm not sure why the facade otherwise. If you think that yes, that has_same_items() really is that much more important, present the case for that rather than irrelevant pedantics. (To be pedantic: at least the allclose() one is not an equivalence > relation, as it would be possible to have > > isclose(a, b) and isclose(b, c) but not isclose(a, c). But that's a > by-the-by.) > Yes. And moreover, we can have: numpy.isclose(a, b) != numpy.isclose(b, a) The math module had a different approach that guarantees symmetry. Neither is a bug, they are just different. But '==' does not guarantee either symmetry or transitivity either. Not even among objects that intense to mean it in more-or-less the ordinary sense. Practicality beats purity. If .isclose() calls things equivalent, them for most purposes the calculation will be fine if you substitute. A strict mathematical equivalence relation is more... Well, strict. But in terms of what programmers usually care about, this is fluff. Fwiw, my proposal is "just write a simple function." I've made that proposal several times in this thread... But I don't think it's exactly PEP in nature.
_______________________________________________ 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/52X6NWWININP4LM7MXL7YKCXEV3JHV7W/ Code of Conduct: http://python.org/psf/codeofconduct/