title: How to print a list consisting of custom class objects
body: <p>Assuming I have a custom class:</p>
  
  <pre><code>class A:
      def __init__(self, x, y):
          self.x = x
          self.y = y
  
      def __str__(self):
          return self.x + ',' + self.y
  </code></pre>
  
  <p>I can get an expected output "x,y" via this :</p>
  
  <pre><code>sample = A('x', 'y')
  print(sample)
  </code></pre>
  
  <p>But if I put sample in a list:</p>
  
  <pre><code>l = [sample]
  print(l)
  </code></pre>
  
  <p>I got this:</p>
  
  <pre><code>[&lt;__main__.A object at 0x7ff8ae170470&gt;]
  </code></pre>
  
  <p>How can I get the expected output?</p>