> min(a)

This does not return a negative minimum on input [1] (because there is none).

> and
>
> min([e for e in a if e >=0]

This does not return a positive minimum on input [0] (because there is none).

I would have said:

    pos_min = min(e for e in a if e > 0)
    neg_min = min(e for e in a if e < 0)

And then deal with the ValueError when there is no such minimum, as appropriate.

-- Devin
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to