title: Circular reference in python
body: <p>I am not sure how python deal with circular reference (reference cycle). I check some answers and found <a href="https://stackoverflow.com/questions/8025888/does-python-gc-deal-with-reference-cycles-like-this">this</a>:</p>
  
  <blockquote>
    <p>Python's standard reference counting mechanism cannot free cycles, so the structure in your example would leak.<br>
    The supplemental garbage collection facility, however, is enabled by default and should be able to free that structure, if none of its components are reachable from the outside anymore and they do not have <code>__del__()</code> methods.</p>
  </blockquote>
  
  <p>I guess it means that if none of the instances in reference cycle are reachable outside, both of them will be cleaned up. Is this true?<br>
  <strong>On the other hand</strong>, there is a package <code>weakref</code> which is often used to deal with map dictionary. The purpose of its existence, I suppose, is to avoid reference cycle.<br>
  In summary, can python deal with reference cycle automatically? If they can, why do we have to use <code>weakref</code>?</p>