Performance Issues please help

John Machin sjmachin at lexicon.net
Thu Jun 2 18:52:06 EDT 2005


Michael Spencer wrote:

>                 minc, minr, maxc, maxr = box[e]
>                 # note correction for c == 0
>                 # also Peter's simplification
>                 box[e] = ( c and (c < minc and c or minc),
>                            minr,
>                            c > maxc and c or maxc,
>                            r)
>

This may be slightly faster (when c > 0), and slightly less opaque:

                  minc, minr, maxc, maxr = box[e]
                  # note correction for c == 0
                  # also Peter's simplification
                  if c < minc:
                      minc = c
                  box[e] = ( minc,
                             minr,
                             c > maxc and c or maxc,
                             r)






More information about the Python-list mailing list