[issue16167] Allow printing of str-derived classes

2012-10-08 Thread Arfrever Frehtes Taifersar Arahesis
Arfrever Frehtes Taifersar Arahesis added the comment: Radu Dan: Printing of str-derived classes works in Python >=3.0, so you should just upgrade to newer version of Python. New features will not be backported to Python 2. -- nosy: +Arfrever resolution: invalid -> works for me __

[issue16167] Allow printing of str-derived classes

2012-10-08 Thread Benjamin Peterson
Benjamin Peterson added the comment: And indeed >>> print(a) hello world -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue16167] Allow printing of str-derived classes

2012-10-08 Thread Benjamin Peterson
Benjamin Peterson added the comment: Python 3.4.0a0 (default:8f048c8c855e, Oct 8 2012, 13:46:48) [GCC 4.5.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> class newstring(str): ... def __str__(self): ... return self ... >>> type(str

[issue16167] Allow printing of str-derived classes

2012-10-08 Thread Radu Dan
New submission from Radu Dan: Classes that extend the builtin 'str' cannot be printed as is, and are automatically converted to string. #!/bin/env python class newstring(str): def __str__(self): return self a = newstring("hello world") print a Running this returns: Tr