"%s" vs unicode
Steve Holden
sholden at holdenweb.com
Tue Jan 7 19:34:34 EST 2003
More information about the Python-list mailing list
Tue Jan 7 19:34:34 EST 2003
- Previous message (by thread): "%s" vs unicode
- Next message (by thread): "%s" vs unicode
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote in message news:JiqD$KAGb2G+Ewyl at jessikat.fsnet.co.uk... > In article <m3u1gkwvui.fsf at mira.informatik.hu-berlin.de>, Martin v. > Löwis <martin at v.loewis.de> writes > >Robin Becker <robin at jessikat.fsnet.co.uk> writes: > > > >> That was considered harmful (although I disagreed) so why is this > >> implicit conversion allowed? > > > >It follows the general principle that, when combining byte strings and > >Unicode strings, the byte string will be converted to Unicode, not > >vice versa. > > > >Regards, > >Martin > > > but the general principal here is that %s converts things to strings. > What is general about breaking this? Well, there's also a widening principle that you seem to be ignoring. In the same way that int+float gives float, and float*complex gives complex, so any string operation involving a Unicode operation gives a Unicode result. Otherwise what would you have Python do with non-translatable Unicode characters it has to handle in a %s substitution? Give an ordinal value error? regards ----------------------------------------------------------------------- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/pwp/ Bring your musical instrument to PyCon! http://www.python.org/pycon/ -----------------------------------------------------------------------
- Previous message (by thread): "%s" vs unicode
- Next message (by thread): "%s" vs unicode
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list