title: Are type hints a safer type checking option than assert?
body: <p>I have 2 code segments to check data types of function arguments.</p>
  
  <p>1st one uses typing</p>
  
  <pre><code>def write_str(str1: str, file1_str: str):
  
      return None
  </code></pre>
  
  <p>2nd one uses <code>assert</code>.</p>
  
  <pre><code>def write_str(str1, file1_str):
      assert (type(str1) == str and type(file1_str) == str)
  
      return None 
  </code></pre>
  
  <p>Does python typing make the use of assert checking unnecessary? Which code segment catches bug better?</p>
  
  <p>I'm using python v3.7</p>