bags? 2.5.x?

Arnaud Delobelle arnodel at googlemail.com
Sun Feb 3 04:02:33 EST 2008


On Feb 2, 5:28 pm, Carsten Haese <cars... at uniqsys.com> wrote:
> On Sat, 2008-02-02 at 01:17 -0800, Paul Rubin 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.
>
> In addition to possibly being more intuitive, the latter also agrees
> with a use case of bags in complex analysis. If you consider the zeroes
> of complex polynomials, let B1 be the zeroes of polynomial P1, and B2 be
> the zeroes of polynomial P2, then B1+B2 are the zeroes of the product
> P1*P2.

Note that I was proposing exactly this: B1+B2 would add
multiplicities.  On top of this, B1.union(B2) would take the max
(maybe spelt B1|B2).  IMHO this is more in the spirit of union:
conceptually, the union of two things is the smallest thing that
contains them both.

--
Arnaud




More information about the Python-list mailing list