max(), sum(), next()

David C. Ullrich dullrich at sprynet.com
Tue Sep 9 11:58:06 EDT 2008


In article 
<b4f287a7-8e1f-4057-9711-2f2519869a10 at m73g2000hsh.googlegroups.com>,
 bearophileHUGS at lycos.com wrote:

> David C. Ullrich:
> > I didn't mention what's below because it doesn't seem
> > likely that saying max([]) = -infinity and
> > min([]) = +infinity is going to make the OP happy...
> 
> Well, it sounds cute having Neginfinite and Infinite as built-int
> objects that can be compared to any other type and are < of or > of
> everything else but themselves.

Like I said, I'm not going to say anything about how Python
should be. If I were going to comment on that I'd say it would
be cute but possibly silly to actually add to the core.

But in the math library I made some time ago there was an
AbsoluteZero with the property that when you added it to
x you got x for any x whatever (got used as the default
additive identity for classes that didn't have an
add_id defined...)

> Probably they can be useful as
> sentinels, but in Python I nearly never use sentinels anymore, and
> they can probably give some other problems...
> 
> Bye,
> bearophile

-- 
David C. Ullrich



More information about the Python-list mailing list