title: checking type of the parameters of a function in python
body: <p>In the first instance, I am aware that this is a source of contention within Python community, namely that type checking is indicative of poor code etc etc. However, its part of my learning experience, and I am wanting to have another skill in my Python toolset.</p>
  
  <pre><code>def do_plus(a,b):
      result=a+b
      return result
  calculated_result=do_plus(12,34567)
  print (calculated_result)
  
  calculated_result=do_plus(12,34567)
  print (calculated_result)
  </code></pre>
  
  <p>Now, when I try:</p>
  
  <pre><code>type(calculated_result) 
  type (do_plus)
  </code></pre>
  
  <p>I get int and function respectively.</p>
  
  <pre><code>type (do_plus(a))
  </code></pre>
  
  <p>the above results in:</p>
  
  <pre><code>"Traceback (most recent call last):
    File "&lt;pyshell#9&gt;", line 1, in &lt;module&gt;
      type (do_plus(a,b))
  NameError: name 'a' is not defined"
  </code></pre>
  
  <p>I am confused by this, surely I have defined a and b within the parenthesis after def do_plus?</p>
  
  <p>The reason I want the type for parameters is to a spot check, i.e. check the type, and if it is not correct, raise a TypeError, regrettably, I am failing at the 1st hurdle it seems :(</p>