[Python-Dev] __str__ bug?

Mike Krell mbk.lists at gmail.com
Tue Oct 24 22:14:22 CEST 2006


> class S(str):
>     def __str__(self): return "S.__str__"
>
> class U(unicode):
>     def __str__(self): return "U.__str__"
>
> print str(S())
> print str(U())
>
> This script prints:
>
> S.__str__
> U.__str__

Yes, but "print U()" prints nothing, and the explicit str() should not
be necessary.

   Mike


More information about the Python-Dev mailing list