title: How to implement "__iadd__()" for an immutable type?
body: <p>I would like to subclass an immutable type or implement one of my own which behaves like an <code>int</code> does as shown in the following console session:</p>
  
  <pre class="lang-none prettyprint-override"><code>&gt;&gt;&gt; i=42
  &gt;&gt;&gt; id(i)
  10021708
  &gt;&gt;&gt; i.__iadd__(1)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  AttributeError: 'int' object has no attribute '__iadd__'
  &gt;&gt;&gt; i += 1
  &gt;&gt;&gt; i
  43
  &gt;&gt;&gt; id(i)
  10021696
  </code></pre>
  
  <p>Not surprisingly, <code>int</code> objects have no <code>__iadd__()</code> method, yet applying <code>+=</code> to one doesn't result in an error, instead it apparently creates a new <code>int</code> and also somehow magically reassigns it to the name given in the augmented assignment statement.</p>
  
  <p>Is it possible to create a user-defined class or subclass of a built-in immutable one that does this, and if so, how?</p>