[Python-Dev] Re: PEP 218 (sets); moving set.py to Lib
Guido van Rossum
Thu, 22 Aug 2002 00:30:09 -0400
> Playing with a sample session for possible inclusion in the
> tutorial, I've found that '|' is not nearly as clear in its
> intention as '+'.
It's way too early to say that. I actually like the fact that | and
& are a new vocabulary (for containers at least) so they provide an
additional hint that we're dealing with a different kind of
For sequences, a+b != b+a (unless a==b). For sets, a|b == b|a.
That's a useful distinction.
+ is already used for two distinct purposes: for numbers (where it
is symmetric) and for sequences (where it is not). But numbers and
sequences are unlikely to be confused because they are used so
differently. Sets and lists are both containers, and I think it's
useful that their vocabularies don't overlap much.
--Guido van Rossum (home page: http://www.python.org/~guido/)