Neil> In interactive mode, you are normally interested in the values of
    Neil> things, not their formatting so it does the right thing. 

    >>> class Dumb:
    ...   def __init__(self, val):
    ...     self.val = val
    ...   def __str__(self):
    ...     return "<Dumb val=%s>" % self.val
    ... 
    >>> d = Dumb(5)
    >>> d
    <__main__.Dumb instance at 0x11042d8>
    >>> print d
    <Dumb val=5>

It's just repr() vs. str(), but the difference can be significant in many
circumstances.

Skip
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to