[Python-Dev] unicode inconsistency?
Tim Peters
tim.peters at gmail.com
Thu Sep 9 21:28:39 CEST 2004
[Batista, Facundo]
> You mean something like %u? (actually don't know if the "u" is used for
> something else)
'%u' is used for unsigned int formats -- although int/long unification
rendered those senseless.
> If %u triggers PyObject_Unicode(), the following will work?
>
> class A:
> def __unicode__(self):
> return u'\u1234'
>
> '%u' % u'\u1234'
> '%u' % A()
That's the intent, yes. Neil's original example would *also* "work"
then (because unlike PyObject_Str(), PyObject_Unicode() is happy to
accept a unicode result as-is from a tp_str implementation).
More information about the Python-Dev
mailing list