Proposal: s1.intersects(s2)

richyjsm at richyjsm at
Thu Jul 5 03:48:58 CEST 2007

On Jul 4, 8:14 pm, Steven D'Aprano
<s... at> wrote:
> However, there's a very subtle flaw in the idea. While "the intersection"
> of two sets is well-defined, "these two sets intersect" is (surprisingly!)
> _not_ well-defined.

Poppycock!  It's perfectly well defined:  two sets intersect if and
only if their intersection is nonempty.  There's absolutely no reason
to single out the empty set for special treatment in this definition.

> The problem comes if we (perhaps naively) try to say that if a set A is a
> subset of set B, set A must intersect with B.

Well of course false statements are going to cause problems.

> (Not all intersecting sets are subsets, but all subsets are intersecting sets.)

Not true.

> As a result, any proposed function or method that returns a True/False
> value for whether set A intersects with set B needs to define (and
> justify) what it means to say that two sets intersect when one or both are
> the empty set.

Nope.  There's one, obvious, correct definition, as given above.  No
need to mention the empty set at all.


More information about the Python-list mailing list