[Python-Dev] Re: PEP 218 (sets); moving set.py to Lib

Magnus Lie Hetland magnus@hetland.org
Sat, 24 Aug 2002 16:33:08 +0200


Eric S. Raymond <esr@thyrsus.com>:
>
> Guido van Rossum <guido@python.org>:
> > Um, the notation is '|' and '&', not 'or' and 'and', and those are
> > what I learned in school.  Seems pretty conventional to me (Greg
> > Wilson actually tried this out on unsuspecting newbies and found that
> > while '+' worked okay, '*' did not -- read the PEP).
> 
> +1 on preferring | and & to `or' and `and'.  To me, `or' and `and' say
> that what's being composed are predicates, not sets.

I concur completely. Using 'or' and 'and' seems close to overriding
'is' (although that's impossible, of course) to me. To me, the
expression

  set1 and set2

should return the first set, if empty, or the second set, if the first
one is empty. Suddenly having their intersection would be very
surprising, I think. For

  set1 & set2

to return their intersection, however, is very consistent with

  int1 & int2

-- 
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org