< is the strict subset operator. <= is subset. What more can I say?

On Mon, Mar 23, 2020 at 02:01 Steven D'Aprano <steve@pearwood.info> wrote:
On Sun, Mar 22, 2020 at 09:49:26PM -0700, Guido van Rossum wrote:
> On Sun, Mar 22, 2020 at 6:51 PM Steven D'Aprano <steve@pearwood.info> wrote:
>
> > We might have a terminology issue here, since according to Wikipedia
> > there is some dispute over whether or not to include the equality case
> > in subset/superset:
> >
> > https://en.wikipedia.org/wiki/Subset
> >
> > For what it is worth, I'm in the school that subset implies proper subset
> > [...]
> >
>
> Wikipedia's pedantry notwithstanding, I don't think this is a useful
> position *when talking about Python sets*, since Python's set's .issubset()
> method returns True when the argument is the same set:

But Python's subset *operator* returns False when the arguments are
equal:

py> {1} < {1}
False

and until today I did not realise the operator and method used different
definitions. I'm going to have to review some of my code using sets to
see if my mistaken understanding that they were the same has introduced
some hidden bugs :-(

I'm not going to get into an argument about which definition is correct.
I think the differences between the operators and the methods should be
better described in the docs, but at least the docs do explicitly note
that set.issubset is equivalent to the `<=` operator.

(Not the docstring though. You have to read the docs on the website.)

Today I read Wikipedia's pedantry and learned for the first time that
there are people who define "subset" to include equality. I had not come
across that before, so I was confused by Steve Jorgensen's talk about
sets that are similtaneously subsets and supersets of themselves. But
now that I realise he is talking about *equal* sets, it makes sense.

I'm still confused by his position that there are sets (iterables?)
which are simultaneously subsets and supersets of each other without
being equal, but that's a separate issue for him to clarify.

--
Steven
_______________________________________________
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/4CAPJG2EEAYPDQWXJ5PVBXNUZ7GWULER/
Code of Conduct: http://python.org/psf/codeofconduct/
--
--Guido (mobile)