title: Unexpected Python TypeError: 'list' object is not callable
body: <p>I want to draw two lines, each works well when separated, but when I draw two at a time, then there's an error: </p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "2.py", line 99, in 
        fspe2 = [fspe(t2,x) for t2 in t]  TypeError: 'list' object is not callable</p>
  </blockquote>
  
  <p>Full Code:</p>
  
  <pre><code># -*- coding: utf-8 -*
  import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib as mpl
  import math
  from pylab import *
  
  c = 2.998*10**10
  hp = 6.626*10**-27
  hb = 1.055*10**-27
  kb = 1.381*10**-16
  g = 6.673*10**-8
  me = 9.109*10**-28
  mp = 1.673*10**-24
  q = 4.803*10**-10
  sigT = 6.652*10**-25
  
  p = 2.5
  r014 = 1
  E53 = 1
  g42 = 1
  delt12 =1
  epsBR2 = 1
  epseR1 = 1
  DLG = 1 
  
  r0 = r014*10**14
  E0 = E53*10**53
  g4 = g42*10**2.5
  delt0 = delt12*10**12
  epseR = epseR1*0.1
  epsBR = epsBR2*0.01
  n1 = 1.0
  k = 0
  DL = DLG*3.086*10**27
  
  N0 = E0/(g4*mp*c**2)
  SedL = (3*E0/(4*math.pi*n1*mp*c**2))**(1./3)
  ttw = delt0/c  
  ttn = SedL/(2*c*g4**(3./8))  
  Reta = SedL/g4**(2./3)
  
  def Gam3(t):
    if delt0 &gt; SedL/(2*g4**(8./3)):
      return np.where(t&lt;ttw,(SedL/delt0)**(3./8)*(4*t/ttw)**(-1./4),(SedL/delt0)**(3./8)*(4*ttw/ttw)**(-1./4)*(t/ttw)**(-7./16))
    else:
      return np.where(t&lt;ttn,g4,g4*(t/ttn)**(-2./5))
  
  def n3(t):
    if delt0 &gt; SedL/(2*g4**(8./3)):
      return np.where(t&lt;ttw,8*Gam3(t)**3*n1/g4,8*Gam3(ttw)**3*n1/g4*(t/ttw)**(-13./16))
    else:
      return np.where(t&lt;ttn,7*n1*g4**2*(t/ttn)**-3,7*n1*g4**2*(t/ttn)**(-6./7))
  
  def e3(t):
    if delt0 &gt; SedL/(2*g4**(8./3)):
      return np.where(t&lt;ttw,4*Gam3(t)**2*n1*mp*c**2,4*Gam3(ttw)**2*n1*mp*c**2*(t/ttw)**(-13./12))
    else:
      return np.where(t&lt;ttn,4*g4**2*n1*mp*c**2,4*g4**2*n1*mp*c**2*(t/ttn)**(-8./7))
  
  def Ne3(t):
    if delt0 &gt; SedL/(2*g4**(8./3)):
      return np.where(t&lt;ttw,N0*(t/ttw),N0)
    else:
      return np.where(t&lt;ttn,N0*(t/ttn)**(3./2),N0)
  
  gem = lambda t : epseR*e3(t)/(n3(t)*me*c**2)*(p-2)/(p-1)
  BR  = lambda t : np.sqrt(8*math.pi*epsBR*e3(t))
  gec = lambda t : 6*math.pi*me*c/(sigT*BR(t)**2*Gam3(t)*t)
  num = lambda t : 3*q*BR(t)/(4*math.pi*me*c)*gem(t)**2*Gam3(t)
  nuc = lambda t : 3*q*BR(t)/(4*math.pi*me*c)*gec(t)**2*Gam3(t)
  Fmax = lambda t : Ne3(t)*math.sqrt(3)*q**3*BR(t)/(me*c**2)*Gam3(t)/(4*math.pi*DL**2)
  
  def fspe(t,u):
    if num(t)&lt;nuc(t):
      return np.where(u&lt;num(t),(u/num(t))**(1./3)*Fmax(t),np.where(u&lt;nuc(t),(u/num(t))**(-(p-1.)/2)*Fmax(t),(u/nuc(t))**(-p/2)*(nuc(t)/num(t))**(-(p-1.)/2)*Fmax(t)))*u
    else:
      return np.where(u&lt;nuc(t),(u/muc(t))**(1./3)*Fmax(t),np.where(u&lt;num(t),(u/nuc(t))**(-1./2)*Fmax(t),(u/num(t))**(-p/2)*(num(t)/nuc(t))**(-1.2)*Fmax(t)))*u
  
  xmin = 2
  xmax = 10
  i = np.arange(xmin,xmax,0.01)
  t = 10**i
  
  plt.figure('God Bless: Lightcure')
  plt.title(r'Lightcurve''\n2 Cases')
  plt.xlabel(r'log t')
  plt.ylabel(r'log Flux')
  
  x = 10**10
  fspe = [fspe(t1,x) for t1 in t] 
  Lightcurve1 = [math.log10(a5) for a5 in fspe]
  plt.plot(i,Lightcurve1,'.',label=r'$\nu=10^{10}$')
  
  ########################
  ## Strange thing happens!The above 4 sentences work well,
  ## why added the same statements, there's an Error?
  x = 10**15
  fspe2 = [fspe(t2,x) for t2 in t] 
  ### This place feedback--Traceback (most recent call last):
  #  File "1.py", line 94, in &lt;module&gt;
  #    fspe2 = [fspe(t2,x) for t2 in t] 
  #TypeError: 'list' object is not callable
  Lightcurve2 = [math.log10(a6) for a6 in fspe2]
  plt.plot(i,Lightcurve2,'&gt;',label=r'$\nu=10^{15}$')
  #######################
  
  plt.legend()
  plt.grid(True)
  plt.show()  
  </code></pre>