[Tutor] Confusion about definition of proper subset in python set

boB Stepp robertvstepp at gmail.com
Fri Oct 30 18:14:23 EDT 2020


On Sat, Oct 31, 2020 at 08:28:36AM +1100, Cameron Simpson wrote:
>On 30Oct2020 09:00, Alan Gauld <alan.gauld at yahoo.co.uk> wrote:
>>On 30/10/2020 02:52, Manprit Singh wrote:
>>> Test whether the set is a proper subset of *other*, that is, set <=
>>> other and set != other.
>>>
>>> This confuses me actually.
>>>
>>> set <= other   and set != other , how it is possible at same time ?
>>
>>Very easily.
>
>I think Manprit Singh has confused "subset" (set <= other) and proper
>subset (set < other). Well, not confused, because he's clearly well
>aware of the distinction. But confused about the docs.
>
>He's correctly pointing out that being a proper subset excludes the "="
>part of "<=". But I can't find anything in the documentation talking
>specificly about "proper subsets", which are themselves a proper subset
>of subsets in general.
>
>The docs only talk about "subsets", which is what issubset() tests,
>along with the <= operator between sets.
>
>Manprit: where in the docs did you find the term "proper subset"? I
>can't see it.

I think that he is referring to:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
issubset(other)
set <= other
Test whether every element in the set is in other.

set < other
Test whether the set is a proper subset of other, that is, set <= other and set != other.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


-- 
Wishing you only the best,

boB Stepp


More information about the Tutor mailing list