Deprecating reload() ???

Terry Reedy tjreedy at udel.edu
Tue Mar 16 16:42:55 EST 2004


"David MacQuigg" <dmq at gain.com> wrote in message
news:42je50p1ephn4uoksbpjjoa8e05otp43le at 4ax.com...
>     def h23(freq):
>         s = complex(2*pi*freq)
>         h0 = PZfuncs.h0
>         z1 = PZfuncs.z1; z2 = PZfuncs.z2
>         p1 = PZfuncs.p1; p2 = PZfuncs.p2; p3 = PZfuncs.p3
>         return h0*(s-z1)*(s-z2)/((s-p1)*(s-p2)*(s-p3))
>
> Notice the clarity in that last formula.  This is a standard form of a
> pole-zero transfer function that will be instantly recognized by a
> circuit design engineer.  The issue isn't the typing of extra
> characters, but the compactness of expressions.

For one use only, making local copies adds overhead without the
compensation of faster multiple accesses.  To make the formula nearly as
clear without the overhead, I would consider

import PZfuncs as z
def h23(freq):
    s = complex(2*pi*freq)
    return z.h0 * (s-z.z1) * (s-z.z2) / ((s-z.p1) * (s-z.p2) * (s-z.p3))

Terry J. Reedy







More information about the Python-list mailing list