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

Tim Peters tim.one@comcast.net
Wed, 21 Aug 2002 21:50:29 -0400

> ...
> 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).

FYI, kjbuckets uses '+' (union) and '&' (intersection).  '*' is used for
graph composition.  It so happens that graph composition applied to sets
views each set as a graph of self-loops

    (1, 2, 7} -> {(1, 1), (2, 2), (7, 7)}

and the composition of two such self-loop graphs is the self-loop graph of
the sets' intersection.  So you can view '*' as being a set intersection
operation there.  It's more useful to compose a graph with a set, in which
case you get the subgraph all of whose start-arc nodes are in the set (set *
graph), or all of whose end-arc nodes are in the set (graph * set).  This is
all very handy if you do a lot of it, but getting comfortable with this
higher-level of view of things is at the other end of a learning curve.