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

Dennis Lee Bieber wlfraed at ix.netcom.com
Fri Nov 22 20:18:01 EST 2002


Eric Brunel fed this fish to the penguins on Friday 22 November 2002 
06:25 am:

> 
> xMax = None
> for -whatever-:
>   -big calculation leading to a value of x-
>   if xMax is None:
>     xMax = x
>   else:
>     xMax = max(x, xMax)
>

        Well, slightly shorter visually:

xMax = None
for -whatever-:
        -big calculation leading to a value of x-
        if xMax is None: xMax = x
        xMax = max(x, xMax)

-- 
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <




More information about the Python-list mailing list