This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author opstad
Recipients opstad, r.david.murray
Date 2011-04-21.19:22:49
SpamBayes Score 4.7664095e-11
Marked as misclassified No
Message-id <1303413773.93.0.253346402266.issue11900@psf.upfronthosting.co.za>
In-reply-to
Content
I guess I was confused by the inconsistency with Python 3, which *does* call the __str__ method, even though, again, no coercion is needed:

Python 3.2 (r32:88452, Feb 20 2011, 10:19:59) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class X(str):
...   def __str__(self):
...     print("In __str__")
...     return "*** " + self + " ***"
... 
>>> x = X("abcde")
>>> print(x)
In __str__
*** abcde ***
>>> print(str(x))
In __str__
*** abcde ***
History
Date User Action Args
2011-04-21 19:22:53opstadsetrecipients: + opstad, r.david.murray
2011-04-21 19:22:53opstadsetmessageid: <1303413773.93.0.253346402266.issue11900@psf.upfronthosting.co.za>
2011-04-21 19:22:49opstadlinkissue11900 messages
2011-04-21 19:22:49opstadcreate