[Tutor] __and_ and and_
Bryan Hann
bryan.hann@pobox.com
Tue, 19 Oct 1999 18:06:46 +0800
Emile van Sebille wrote:
> You can then write
> c = a + b # to show the union
> --- or ---
> c = a - b # for the intersection
Yes, though I would strongly recommend a * b for intersection,
and reserve a - b for non-commutative set (or list) difference.
>>>a=mySet([1,2,3,4,5])
>>>b=mySet([3,4,5,6,7])
>>>print a*b, a-b, b-a
[3,4,5] [1,2] [6,7]
(assuming appropriate definition of mySet.__repr__ of course!)
--Bryan Hann