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 call and all string methods auto-coerce to Unicode in case a Unicode object is found among the arguments. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4