title: sys.getrefcount continuation
body: <p><a href="https://stackoverflow.com/questions/759740/sys-getrefcount/759763#759763">link text</a></p>
  
  <p>I got the concept of reference count</p>
  
  <p>So when i do a "del astrd" ,reference count drops to zero and astrd gets collected by gc ?</p>
  
  <p>This is the sample codes.These codes I developed after my yesterday's question:<a href="https://stackoverflow.com/questions/755694/delete-pyc">link text</a></p>
  
  <p>one.py:</p>
  
  <p>def abc():</p>
  
  <pre><code>print "Hello"
  print "123"
  print '345'
  </code></pre>
  
  <p>two.py:</p>
  
  <pre><code>import one
  #reload(one)
  
  #def defg():
  
  one.abc()
  </code></pre>
  
  <p>three.py:</p>
  
  <pre><code>import os,sys,gc
  from time import sleep
  
  import two
  #reload(two)
  #two.defg()
  
  sleep(20)
  
  
  directory = os.listdir('.')
  
  for filename in directory:
  
          if filename[-3:] == 'pyc':
  
                  print '- ' + filename
  
                  print sys.getrefcount(filename)
  
                  file_name = os.path.splitext (filename)[0]
  
                  del file_name   # remove the local reference
  
                  del sys.modules[os.path.splitext (filename)[0]] # removes import
  
                  gc.collect()    # garbage collect
  
                  #del sys.modules[filename]
  
                  #del filename
  
                  #os.remove(filename)
  </code></pre>
  
  <p>What i did in three.py is correct or not ?
  Is there any unnecessary step ?If yes,why ?</p>
  
  <p>Please help me out of this.</p>