title: Immutable vs Mutable types
body: <p>I'm confused on what an immutable type is. I know the <code>float</code> object is considered to be immutable, with this type of example from my book:</p>
  
  <pre><code>class RoundFloat(float):
      def __new__(cls, val):
          return float.__new__(cls, round(val, 2))
  </code></pre>
  
  <p>Is this considered to be immutable because of the class structure / hierarchy?, meaning <code>float</code> is at the top of the class and is its own method call. Similar to this type of example (even though my book says <code>dict</code> is mutable):</p>
  
  <pre><code>class SortedKeyDict(dict):
      def __new__(cls, val):
          return dict.__new__(cls, val.clear())
  </code></pre>
  
  <p>Whereas something mutable has methods inside the class, with this type of example:</p>
  
  <pre><code>class SortedKeyDict_a(dict):
      def example(self):
          return self.keys()
  </code></pre>
  
  <hr>
  
  <p>Also, for the last <code>class(SortedKeyDict_a)</code>, if I pass this type of set to it:</p>
  
  <pre><code>d = (('zheng-cai', 67), ('hui-jun', 68),('xin-yi', 2))
  </code></pre>
  
  <p>without calling the <code>example</code> method, it returns a dictionary. The <code>SortedKeyDict</code> with <code>__new__</code> flags it as an error. I tried passing integers to the <code>RoundFloat</code> class with <code>__new__</code> and it flagged no errors.</p>