Boris Borcic <[EMAIL PROTECTED]> writes:
> x.sort(cmp = lambda x,y : cmp(random.random(),0.5))
> pick a random shuffle of x with uniform distribution ?

You really can't assume anything like that.  Sorting assumes an order
relation on the items being sorted, which means if a < b and b < c,
then a < c.  If your comparison operation doesn't preserve that
property then the sort algorithm could do anything, including looping
forever or crashing.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to