title: What is the most pythonic way to check if an object is a number?
body: <p>Given an arbitrary python object, what's the best way to determine whether it is a number? Here <code>is</code> is defined as <code>acts like a number in certain circumstances</code>.</p>
  
  <p>For example, say you are writing a vector class. If given another vector, you want to find the dot product. If given a scalar, you want to scale the whole vector.</p>
  
  <p>Checking if something is <code>int</code>, <code>float</code>, <code>long</code>, <code>bool</code> is annoying and doesn't cover user-defined objects that might act like numbers. But, checking for <code>__mul__</code>, for example, isn't good enough because the vector class I just described would define <code>__mul__</code>, but it wouldn't be the kind of number I want.</p>