title: How to avoid a mutable subclass as a property in Python from being shared across two class instantiations?
body: <p>I have a top level class <code>Car</code> with <code>Tire</code> class as a property. When I update <code>Tire</code> from a top-level instantiation of the class (<code>honda</code> in example below), it also updates the other instance (<code>bmw</code> in example below).</p>
  <p>Is there a way to make the assert statement below True? I could make <code>Tire</code> inherit from <code>NamedTuple</code>, but then it would be immutable, and I would not be able to simple update a property such as with <code>honda.tire.tread_count=44</code>.</p>
  <p>Example Program with failing assert:</p>
  <pre class="lang-py prettyprint-override"><code>class Tire():
      def __init__(self, tread_count: int, size: int):
          self.tread_count = tread_count
          self.size = size
  
  class Car():
      def __init__(self, color: str = &quot;red&quot;, tire: Tire = Tire(tread_count=50, size=20)):
          self.color = color
          self.tire = tire
  
  # Instantiate honda and change a property.
  honda = Car()
  print(honda.tire.tread_count)
  honda.tire.tread_count=44
  print(honda.tire.tread_count)
  # Instantiate bmw.
  bmw = Car()
  print(bmw.tire.tread_count)
  assert bmw.tire.tread_count == 50
  # Question -- How can we make bmw not get updated by updating honda?
  </code></pre>
  <p>Output of example program:</p>
  <pre class="lang-sh prettyprint-override"><code>50
  44
  44
  ---------------------------------------------------------------------------
  AssertionError                            Traceback (most recent call last)
       17 bmw = Car()
       18 print(bmw.tire.tread_count)
  ---&gt; 19 assert bmw.tire.tread_count == 50
       20 # Question -- How can we make bmw not get updated by updating honda?
  AssertionError: 
  </code></pre>