Printing a list of objects
<p>I am a Python newbie. I have this small problem. I want to print a list of objects but all it prints is some weird internal representation of object. I have even defined <code>__str__</code> method but still I am getting this weird output. What am I missing here?</p>

<pre><code>class person(object):
  def __init__(self, name, age):
    self.name = name
    self.age = age

  def __str__(self):
     return self.name + "(" + str(self.age) + ")"

def partition(coll, pred):
  left = []
  right = []
  for c in coll:
    if pred(c):
      left.append(c)
    else:
      right.append(c)
  return left, right


people = [
  person("Cheryl", 20),
  person("Shemoor", 14 ),
  person("Kimbala", 25),
  person("Sakharam", 8)
]

young_fellas, old_fellas = partition(people, lambda p : p.age &lt; 18)
print(young_fellas)
print(old_fellas)
</code></pre>

<p>Please note that I know I can use either a <code>for</code> loop or a <code>map</code> function here. I am looking for something shorter and more idiomatic. Thanks.</p>

<p><strong>EDIT:</strong></p>

<p>One more question: Is the above code of mine Pythonic?</p>
