title: Printing cyclic data structures
body: <p>Python's print statement often works on arbitrary data structures (in particular those made by argparse.Namespace), which is useful. One case where it doesn't work is where you're dealing with complex object graphs containing cycles (one object points to another, which points back to the original object); this trips infinite recursion on trying to convert the objects to a string.</p>
  
  <p>Is there a way to create a string representation, suitable for printing for debugging purposes, that checks for cycles and so can handle arbitrary object graphs? (Python 2.7 if it matters.)</p>