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

M.-A. Lemburg mal at egenix.com
Tue Aug 23 12:39:03 CEST 2005

Thomas Heller wrote:
> 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.

Same here.

A new API would also help make the transition easier from the
current mixed data/text type (strings) to data-only (bytes)
and text-only (text, renamed from unicode) in Py3.0.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Aug 23 2005)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Python-Dev mailing list