title: Beautifulsoup, maximum recursion depth reached
body: <p>This is a <code>beautifulsoup</code> procedure  that grabs content within all <code>&lt;p&gt;</code> html tags. After grabbing content from some web pages, I get an error that says maximum recursion depth exceeded. </p>
  
  <pre><code>def printText(tags):
      for tag in tags:
          if tag.__class__ == NavigableString:
              print tag,
          else:
              printText(tag)
      print ""
  #loop over urls, send soup to printText procedure
  </code></pre>
  
  <p>The bottom of trace:</p>
  
  <pre><code> File "web_content.py", line 16, in printText
      printText(tag)
    File "web_content.py", line 16, in printText
      printText(tag)
    File "web_content.py", line 16, in printText
      printText(tag)
    File "web_content.py", line 16, in printText
      printText(tag)
    File "web_content.py", line 16, in printText
      printText(tag)
    File "web_content.py", line 13, in printText
      if tag.__class__ == NavigableString:
  RuntimeError: maximum recursion depth exceeded in cmp
  </code></pre>