Steve Jorgensen wrote:
> Basically, it is for a sense of completeness. It feels weird that there is a way to check whether an iterable is a subset of a set or a superset
> of a set but no way to directly ask whether it is equivalent to the set.

I can't say this has never happened historically, but I've yet to ever see a change proposal accepted simply on the basis of "completeness". There typically has to be some form of concrete, practical use case for the feature. Otherwise, it's quite simply not going to be worth the review and long-term maintenance cost to the limited core CPython development resources.

> Even though the need for it might not be common, I think that the collection of methods makes more sense if a method like this is present.

It's okay if the need isn't very common, but it still typically requires some real use case to be clearly defined. Even if it might be fairly niche, are there any?

(Note that if it's too niche, it's likely more suitable as a 3rd party package.)

On Sun, Mar 22, 2020 at 8:11 PM Steve Jorgensen <stevej@stevej.name> wrote:
Paul Moore wrote:
> On Sun, 22 Mar 2020 at 20:01, Steve Jorgensen stevej@stevej.name wrote:
> >
> > Currently, the issubset and
> > issuperset methods of set objects accept arbitrary iterables as arguments. An
> > iterable that is both a subset and superset is, in a sense, "equal" to the set. It would
> > be inappropriate for == to return True for such a comparison,
> > however, since that would break the Hashable contract.
> > Should sets have an additional method, something like like(other),
> > issimilar(other), or isequivalent(other), that returns
> > True for any iterable that contains the all of the items in the set and no
> > items that are not in the set? It would therefore be true in the same cases where
> > <set> = set(other) or <set>.issubset(other) and
> > <set>.issuperset(other) is true.
> > What is the practical use case for this? It seems like it would be a
> pretty rare need, at best.
> Paul

Basically, it is for a sense of completeness. It feels weird that there is a way to check whether an iterable is a subset of a set or a superset of a set but no way to directly ask whether it is equivalent to the set.

Even though the need for it might not be common, I think that the collection of methods makes more sense if a method like this is present.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/MRCHHRVCXEUAB3HBV4WRMZ56O3HUJQYL/
Code of Conduct: http://python.org/psf/codeofconduct/