Dave Opstad <[email protected]> added the comment:
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 ***
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue11900>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com