Movatterモバイル変換
[0]ホーム
[Python-Dev] Re: [Patches] Unicode Patch Set 2000-04-10
M.-A. Lemburgmal@lemburg.com
Mon, 10 Apr 2000 12:55:50 +0200
Greg Stein wrote:>> On Mon, 10 Apr 2000, M.-A. Lemburg wrote:> > The attached patch includes the following fixes and additions:> >...> > * '...%s...' % u"abc" now coerces to Unicode just like> > string methods. Care is taken not to reevaluate already formatted> > arguments -- only the first Unicode object appearing in the> > argument mapping is looked up twice. Added test cases for> > this to test_unicode.py.> >...>> I missed a chance to bring this up on the first round of discussion, but> is this really the right thing to do? We never coerce the string on the> left based on operands. For example: if the operands are class instances,> we call __str__ -- we don't call __coerce__.>> It seems a bit weird to magically revise the left operand.>> In many cases, a Unicode used as a string is used as a UTF-8 value. Why is> that different in this case? Seems like a wierd special case.It's not a special case: % works just like a method calland all string methods auto-coerce to Unicode in case aUnicode object is found among the arguments.-- Marc-Andre Lemburg______________________________________________________________________Business:http://www.lemburg.com/Python Pages:http://www.lemburg.com/python/
[8]ページ先頭