[Python-Dev] Revised PEP 349: Allow str() to return unicode strings

Thomas Heller theller at python.net
Tue Aug 23 12:19:11 CEST 2005


Neil Schemenauer <nas at arctrix.com> writes:

> [Please mail followups to python-dev at python.org.]
>
> The PEP has been rewritten based on a suggestion by Guido to change
> str() rather than adding a new built-in function.  Based on my
> testing, I believe the idea is feasible.  It would be helpful if
> people could test the patched Python with their own applications and
> report any incompatibilities.
>

I like the fact that currently unicode(x) is guarateed to return a
unicode instance, or raises a UnicodeDecodeError.  Same for str(x),
which is guaranteed to return a (byte) string instance or raise an
error.

Wouldn't also a new function make the intent clearer?

So I think I'm +1 on the text() built-in, and -0 on changing str.

Thomas



More information about the Python-Dev mailing list