On Thu, 7 May 2020 21:18:16 +1000 Steven D'Aprano <st...@pearwood.info> wrote:
> > The strongest equality is the "is" operator > > Please don't encourage the conceptual error of thinking of `is` as > *equality*, not even a kind of equality. It doesn't check for equality, > it checks for *identity* and we know that there is at least one object > in Python where identical objects aren't equal: > > py> from math import nan > py> nan is nan > True > py> nan == nan > False We'd better agree to disagree on this one. > > The very far ends of that scale are glossing over American > > vs. British spellings (are "color" and "colour" in some sense equal?), > > YAGNI. > The proposal here is quite simple and straightforward, there is no > need to over-generalise it to the infinite variety of possible > equivalencies than someone might want. People can write their own > functions. YAGNI is how I feel about an operator that compares sequences element by element. People can write their own functions. :-) Or add your .EQ. function to the standard library (or even to builtins, and no, I don't have a good name). > It is only that wanting to compare two ordered containers for equality > of their items without regard to the type of container is a reasonably > common and useful thing to do. > Even if we don't want list==tuple to return True -- and I don't! -- we > surely can recognise that sometimes we don't care about the > container's type, only it's elements. Do "reasonably common," "useful," and "sometimes" meet the bar for a new operator? (That's an honest question and not a sharp stick.) FWIW, I agree: list != tuple. When's the last time anyone asked for the next element of a tuple? (Okay, if your N-tuple represents a point in N-space, then you might iterate over the coordinates in order to discover a bounding box.) Dan -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan _______________________________________________ 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/N5OMIARPTO2GATG7ANLVUJ7HZHGKP5NY/ Code of Conduct: http://python.org/psf/codeofconduct/