title: How to check if len is valid
body: <p>I have a function</p>
  
  <pre><code>def foo(bar):
      #do some things
      len(bar)
  </code></pre>
  
  <p>If I call</p>
  
  <pre><code>foo(42)
  </code></pre>
  
  <p>it throws an exception of </p>
  
  <blockquote>
    <p>TypeError: object of type 'int' has no len()</p>
  </blockquote>
  
  <p>How do I check if the entered value can be used with len()?</p>