title: Python: function takes at most 4 arguments (5 given)
body: <p>My function is as follows using python: </p>
  
  <pre><code>def PlotCurve(SourceClipName,mode,TestDetails,savepath='../captures/',**args):
  
      curves=[]
      for a in range(0,len(args)):
          y=[]
          for testrates in TestDetails.BitratesInTest:
  
              stub = args[a].Directory[testrates]
              y.append(args[a].DataSet[stub][0])
              curves.append(y)
  
      plt.figure()
      plt.xlabel("Bitrate")
      plt.ylabel(mode)
      plt.title(TestDetails.HDorSD+" "+TestDetails.Codec + " " + SourceClipName[:-4])
      colour=["green","red","brown","orange","purple","grey","black","yellow","white",]
      CurveIDs=[]
      for x in args:
          CurveIDs.append(args.ID)
      p=[]    
      for b in range(0,len(args)-1):
          p[b].plot(TestDetails.BitratesInTest,y[b],c=colour[b])
  
      plt.legend((p),(CurveIDs),prop={"size":8})
      plt.savefig(os.path.join(savepath,mode+"_"+TestDetails.codec+"_"+SourceClipName[:-4]+".png"))
  </code></pre>
  
  <p>The error specifically is</p>
  
  <pre><code>TypeEror: PlotCurve() takes at most 4 arguments (5 given)
  </code></pre>
  
  <p><code>**args</code> is a list of objects that has been passed into the function</p>
  
  <p>It appears to me that I have defined a function which accepts 5 or more arguments (regardless of whether it works properly or not), but the program disagrees, what is it I am missing which makes the function think it can only have at most 4 parameters?</p>