Basically __repr__ should return a string representaion of the object, 
and __str__ should return a user-friendly pretty string. So maybe:

class Person:
   ...
   def __repr__(self):
     return '<Person: %s, %d, %s>' % (self.name, self.age, self.sign)

   def __str__(self):
     return self.name

See this for a better explanation:

http://www.faqts.com/knowledge_base/view.phtml/aid/1331/fid/241
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to