Proposal: min(None, x) and max(None, x) return x

Greg Ewing see_reply_address at something.invalid
Tue Nov 26 21:58:55 EST 2002


Skip Montanaro wrote:
 >

>     xlist = []
>     for -whatever-:
>         xlist.append(big_hairy_calc)
>     xMax = max(xlist)


Or if you don't want to store the whole list,

   def g():
     for -whatever-:
       yield big_hairy_calc

   xmax = max(g())

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list