title: Why does a subclass of int allow __setattr__ with arbitrary names
body: <p>I defined a class <code>MyInt</code> as a subclass of <code>int</code>, then instantiated an object of it.
  I found it legal to set a value to a non-existing attribute <code>&quot;x&quot;</code> by assigning <code>.x = 1</code>:</p>
  <pre><code>class MyInt(int):
      pass
  
  a = MyInt()
  a.x = 1
  </code></pre>
  <p>However if I try to do <code>.x = 1</code> to an <code>int</code> then it complains</p>
  <pre><code>b = 0
  b.x = 1
  
  
  AttributeError: 'int' object has no attribute 'x'
  ---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  /var/folders/pd/rtb4xpwj0cdd6gk9jr3z3_280000gn/T/ipykernel_66385/2856995082.py in &lt;module&gt;
        1 b = 0
  ----&gt; 2 b.x = 1
  
  AttributeError: 'int' object has no attribute 'x'
  </code></pre>
  <p>My question is: if <code>MyInt</code> inherits all the methods from <code>int</code> without overriding, why does <code>setattr</code> behave differently on their instances?</p>
  <p>edit: by <code>setattr</code> here I meant <code>__setattr__</code>.</p>