title: How do I define class output in ipython console
body: <p>Let's say I have the following code:</p>
  
  <pre><code>class PrintStuff:
      def __init__(self,stuff):
          self._stuff = stuff
  
      def __str__(self):
          return self._stuff
  </code></pre>
  
  <p>If I make an instance of it in ipython and type the name of the instance, it prints out what appears to be the name of the class and the location of it in memory. However if I put the instance into the print function, it prints out as expected:</p>
  
  <pre><code>pstuff = PrintStuff('print this stuff')
  
  pstuff
  Out[44]: &lt;__main__.PrintStuff at 0x7fae0531de80&gt;
  
  print(pstuff)
  print this stuff
  </code></pre>
  
  <p>How would I go about making it so that the ipython console prints the same stuff that the print function does? For example, a pandas series has the type of behavior I am looking for:</p>
  
  <pre><code>series = pd.Series({'x':[1,2],'y':[2,3],'z':[3,4]})
  
  series
  Out[47]: 
  x    [1, 2]
  y    [2, 3]
  z    [3, 4]
  dtype: object
  
  print(series)
  x    [1, 2]
  y    [2, 3]
  z    [3, 4]
  dtype: object
  </code></pre>