title: Looping through os.walk() confusion
body: <p>I'm  working on a script that will crawl a hard drive and collect information on each file
  it encounters by way of fnmatch and magic.</p>
  <p>I have a feeling that the first nested for-loop in <code>yield_files(root)</code> are unnecessary</p>
  <pre><code>def yield_files(root):
      
      for root, dirs, files in os.walk(root):
          &quot;&quot;&quot; Is this necessary 
  
          for directory in dirs:
              for filename in directory:
                  filename = os.path.join(root, filename)
                  if os.path.isfile(filename) or os.path.isdir(filename):
                      yield FileInfo(filename)
          &quot;&quot;&quot;
  
          for filename in files:
              filename = os.path.join(root, filename)
              if os.path.isfile(filename) or os.path.isdir(filename):            
                  yield FileInfo(filename)
                      
  </code></pre>
  <p>Would <code>os.walk()</code> end-up recursing into these directories anyway?</p>