[Python-ideas] 'default' keyword argument for max(), min()

John Arbash Meinel john.arbash.meinel at gmail.com
Wed Apr 15 20:19:35 CEST 2009


...

> Are the typical use cases occuring with iterables that are also
> sequences?  If so, why would a default argument be better
> than a conditional expression:
> 
>    x = min(s) if s else 0
> 
> 
> Raymond
> 

Because min(s) if s could be a generator which won't evaluate to False,
even though it returns no entries.

John
=:->



More information about the Python-ideas mailing list