title: Descructing class also destruct another class in use in it?
body: <p>I'm <strong>still a beginner to python</strong> and i'm currently using version <strong>2.7</strong> for a little module i want to make.</p>
  
  <p>It's for creating menus (for now, pretty simple)</p>
  
  <p><strong>UPDATE based on Daniel's and delnan's answers :</strong></p>
  
  <p>Each menu is an object :</p>
  
  <pre><code>class UiNavMenu(object):
  
      def __init__(self):
         self.title = title
         self.links = []
  
      def add(self, title, link, **kwargs):
          '''
          Add a link to the menu by creating a UiNavLink object.
          '''
          link = UiNavLink(title, link, kwargs)
          self.links.append(link)
  
      def clear(self):
          '''
          Clear all links in the menu
          '''
          self.links = []
  
      def __repr__(self):
          return "&lt;UInavmenu object&gt; Menu '%s' : %s links" % (self.title, len(self.links))
  </code></pre>
  
  <p>This is actually pretty basic.</p>
  
  <p>And now the link object :</p>
  
  <pre><code>class UiNavLink(object):
  
      def __init__(self, title, link, **kwargs):
  
          self.title = title
          self.link = link
  
          for key, value in kwargs.items():
              self.key = value
  </code></pre>
  
  <p>So now, the thing i wanted to know is :</p>
  
  <p>First, i know that python use a garbage collector and an object is destroyed at the and of his process.</p>
  
  <p>But if i use the clean() method of a menu object like : menu.clean(), the menu will be destroyed with all of his contents. So the list in it (self.lists) will be destroyed too.</p>
  
  <p>But does the links object (UiNavLink objects) contained in the list will be destroyed too so i don't have to take care of it ? 
  or does i have to take care of it manually ?!</p>
  
  <p>Thanks you very much :)</p>
  
  <p>Yann</p>