title: Python 2.7: Ints as objects
body: <p>How does an int in python avoid being an object but yet is one:</p>
  
  <p>If I do the following:</p>
  
  <pre><code>&gt;&gt;&gt; dir(10)
  ['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__', '__delattr__', '__div__', '__divmod__', '__doc__', '__float__', '__floordiv__', '__format__', '__getattribute__', '__getnewargs__', '__hash__', '__hex__', '__index__', '__init__', '__int__', '__invert__', '__long__', '__lshift__', '__mod__', '__mul__', '__neg__', '__new__', '__nonzero__', '__oct__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdiv__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'imag', 'numerator', 'real']
  &gt;&gt;&gt; 10.__add__(20)
    File "&lt;stdin&gt;", line 1
      10.__add__(20)
               ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>If I type in 10. it produces 10.0 whereas anything such as 10.__ anything __ produces a syntax error. It does make sense since a float would be considered as 10.5 but</p>
  
  <ol>
  <li>how is this achieved/implemented? </li>
  <li>how can I call the int methods on an int?</li>
  </ol>