TypeError: bad operand type for abs(): 'list'
<p>The following simple code returns: TypeError: bad operand type for abs(): 'list' </p>

<pre><code>from scipy.signal import residue

def x_filter():
    p = [complex(-2505.707527665261,3165.104073896715),complex(-2505.707527665261,-3165.104073896715),complex(-3449.516723926777,1032.914743287806),complex(-3449.516723926777,-1032.914743287806)]
    r = [complex(-1981.17378001573,2672.79673635191),complex(-1981.17378001573,-2672.79673635191),complex(1981.17378001573,-10000.37025226017),complex(1981.17378001573,10000.37025226017)]
    k = []

    [b,a]=residue(r,p,k)

filtered = x_filter()
</code></pre>

<p>I replaced p and r with:</p>

<pre><code>p = [-2505.707527665261+3165.104073896715j,-2505.707527665261-3165.104073896715j,-3449.516723926777+1032.914743287806j,-3449.516723926777-1032.914743287806j]
r = [-1981.17378001573+2672.79673635191j,-1981.17378001573-2672.79673635191j,1981.17378001573-10000.37025226017j,1981.17378001573+10000.37025226017j]
</code></pre>

<p>..., but makes no difference.</p>

<p>Am I doing something wrong?
Is there any workaround?</p>

<p>I referred to <a href="https://stackoverflow.com/questions/34956761/bad-operand-type-for-abs-list">bad operand type for abs(): &#39;list&#39;</a>, but I cannot apply that solution because the __builtin__.abs() function is used in scipy.signal.residue (not in my code).</p>