Py2.3: Feedback on Sets

David Eppstein eppstein at
Mon Aug 18 18:18:52 CEST 2003

In article <7h3d6f3143s.fsf at>,
 Michael Hudson <mwh at> wrote:

> Yup!  Well, *, anyway.  I'd prefer a Haskell-style ++ for
> concatenation, but + isn't totally silly (strings and lists are
> monoids, at least :-).  list * int, OTOH, seems a bit smelly to me
> (though I'm not sure what a better spelling would be...).

Multiplication by (nonnegative) integers is a pretty standard thing to 
do in monoids, and means close to what Python's list*int syntax does: 
add the thing to itself that many times.

I'm not sure why multiplying a list by a negative number produces the 
empty list instead of an exception, though.

David Eppstein            
Univ. of California, Irvine, School of Information & Computer Science

More information about the Python-list mailing list