Proposal: min(None, x) and max(None, x) return x
Skip Montanaro
skip at pobox.com
Fri Nov 22 19:19:21 EST 2002
Chad> xMax = []
Chad> for -whatever-:
Chad> -big calculation leading to a value of x-
Chad> xMax = [max([x]+xMax)]
Chad> xMax = xMax[0]
Wouldn't it be better to accumulate all your x's in a list and call max once
at the end:
xlist = []
for -whatever-:
xlist.append(big_hairy_calc)
xMax = max(xlist)
?
--
Skip Montanaro - skip at pobox.com
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list