"%s" vs unicode
Robin Becker
robin at jessikat.fsnet.co.uk
Tue Jan 7 14:26:16 EST 2003
A user reports that an old style error message is being smashed as the
message was being turned into unicode.
the situation was of the form
raise "xxxx %s' % var
where var was a lump of unicode. We can easily correct the sistuation.
We didn't expect unicode, but what's surprising is that "%s" % u'A' -->
u'A'.
Doesn't %s mean take the str()?
I looked in vain in the docs for the definition of exactly what "%s" % x
is supposed to mean, but somehow this kind of reminds me of the old /
operator dispute ie int / int --> int & int / float --> float.
That was considered harmful (although I disagreed) so why is this
implicit conversion allowed?
--
Robin Becker
More information about the Python-list
mailing list