Py2.3: Feedback on Sets

David Eppstein eppstein at ics.uci.edu
Mon Aug 18 12:18:52 EDT 2003


In article <7h3d6f3143s.fsf at pc150.maths.bris.ac.uk>,
 Michael Hudson <mwh at python.net> 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                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list