> On Mar 22, 2020, at 18:54, Steven D'Aprano <st...@pearwood.info> wrote:
> 
> Do you have an example of `A <= B and B <= A` aside from the `A == B` 
> case?

For mathematical sets, this is either impossible by definition, or impossible 
by 2-line proof, depending on which definitions you like. For Python sets, 
presumably you could come up with something pathological involving some kind of 
“anti-NaN” value that’s equal to everything?

But I don’t think that’s relevant here. You claimed that 'the "arbitrary 
iterables" part is a distraction', but I think it’s actually the whole point of 
the proposal. The initial suggestion is that there are lots of iterables that 
are both a subset and a superset of some set, and only the ones that are sets 
are equal to the set, and not having a way to test for the ones that aren’t 
sets is the “missing functionality” that needs to be added for completeness.

And that’s what you’re missing at the end of your previous message: you don’t 
see “how `<set>.issubset(other) and <set>.issuperset(other)` can be true” if 
the set and other aren’t equal: it’s true whenever other isn’t a set. And if 
you need it more concrete:

    >>> {1.2}.issubset((1,2))
    True
    >>> {1.2}.issuperset((1,2))
    True
    >>> {1,2} == (1,2)
    False

So, asking for an example of ones that are sets but still can’t be tested for 
equality is non sequitur. The OP didn’t expect there to be any, and isn’t 
trying to solve that problem even if there are.

As far as I can tell, they’re just trying to add a method isequivalent or 
iscoextensive or whatever that extends beyond == to handle non-set iterables in 
the exact same way issubset and issuperset extend beyond <= and >= to handle 
non-set iterables.

That’s a perfectly coherent request, and of course arbitrary iterables are 
relevant to it. The question is why anyone would ever need that method. If 
someone has a use case for it, they should be able to post it easily.
_______________________________________________
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/L7SNOAGXR3ARHXSJTG4FQ6U56GVAN2UD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to