Deprecating reload() ???

David MacQuigg dmq at gain.com
Tue Mar 16 19:20:25 EST 2004


On Tue, 16 Mar 2004 16:42:55 -0500, "Terry Reedy" <tjreedy at udel.edu>
wrote:

>"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))

This is equivalent to:

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

Either way we have the architectural problem of ensuring that the code
just above the def gets executed *after* each reload of PZfuncs, and
*before* any call to h23.

-- Dave




More information about the Python-list mailing list