bags? 2.5.x?

MRAB google at mrabarnett.plus.com
Sat Feb 2 10:21:18 EST 2008


On Feb 2, 9:17 am, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Arnaud Delobelle <arno... at googlemail.com> writes:
> > * For sets {x, y} union {y, z} = {x, y, z}.  The natural way of
> >   extending this to multisets is having the union operator take the
> >   max of the multiplicities of each element, i.e.
>
> That certainly doesn't fit the intuition of a bag of objects.  I'd
> think of the union of two bags as the result of dumping the contents
> of both bags onto the table, i.e. you'd add the two vectors.
>
I could see uses for both types of union. You could have both A + B
which adds the multiplicities (the smallest bag which contains both
the bags) and A | B which takes the max of the multiplicities (the
smallest bag which contains either of the bags).

> > * Similarly, for intersection one would take the min of
> > multiplicities, i.e.
>
> This is a reasonable interpretation I guess.
>
> > A difference B = A - (A intersection B)
>
> I think difference would mean subtraction.



More information about the Python-list mailing list