[Python-Dev] unicode inconsistency?

M.-A. Lemburg mal at egenix.com
Wed Mar 9 11:10:59 CET 2005

Neil Schemenauer wrote:
> On Sat, Apr 04, 1998 at 07:04:02AM +0000, Tim Peters wrote:
>>[Martin v. L?wis]
>>>I can't see any harm by supporting this operation also if __str__ returns
>>>a Unicode object.
>>It doesn't sound like a good idea to me, at least in part because it
>>would be darned messy to implement short of saying "OK, we don't give
>>a rip anymore about what type of objects PyObject_{Str,Repr} return",
> It's about 10 lines of code.  See http://python.org/sf/1159501 .

The patch implements the PyObjbect_Text() idea (an API that
returns a basestring instance, ie. string or unicode) and
then uses this in '%s' (the string version) to properly propogate
to u'%s' (the unicode version).

Maybe we should also expose the C API as suggested in the patch,
e.g. as text(obj).

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Mar 09 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