[Python-ideas] Break the dominance of boolean values in boolean context

Terry Reedy tjreedy at udel.edu
Wed Sep 14 18:01:00 CEST 2011


On 9/14/2011 7:30 AM, Ned Batchelder wrote:

> For example, max([]) raises a ValueError, so why doesn't any([])?

You should turn the question around, any([]) returns the identity 
element for any(), so why does't max([])?  Because Python does not have 
an artificial universal minimum object. Guido has rejected the idea and 
it makes even less sense in Python where cross-type comparisons are 
generally discouraged. If max and min were restricted to totally ordered 
numbers, then fhi=float('inf') and flo=-fhi would work. But they are not.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list