title: How do I pass extra arguments to a Python decorator?
body: <p>I have a decorator like below.</p>
  
  <pre><code>def myDecorator(test_func):
      return callSomeWrapper(test_func)
  def callSomeWrapper(test_func):
      return test_func
  @myDecorator
  def someFunc():
      print 'hello'
  </code></pre>
  
  <p>I want to enhance this decorator to accept another argument like below</p>
  
  <pre><code>def myDecorator(test_func,logIt):
      if logIt:
          print "Calling Function: " + test_func.__name__
      return callSomeWrapper(test_func)
  @myDecorator(False)
  def someFunc():
      print 'Hello'
  </code></pre>
  
  <p>But this code gives the error,</p>
  
  <blockquote>
    <p>TypeError: myDecorator() takes exactly 2 arguments (1 given)</p>
  </blockquote>
  
  <p>Why is the function not automatically passed? How do I explicitly pass the function to the decorator function?</p>