Guido van Rossum wrote: > > > No problem... :-) Its a simple fix: once %s in an 8-bit string > > sees a Unicode object it will stop processing the string and > > restart using the unicode formatting algorithm. > > But the earlier items might already have incurred side effects > (e.g. when rendering user code)... Unless you save all the strings > you got for reuse, which seems a pain as well. Oh well... I don't think it's worth getting this 100% right. We'd need quite a lot of code to store the intermediate results and then have them reused during the Unicode %-formatting -- just to catch the few cases where str(obj) does have side-effects: the code would have to pass the partially rendered string pasted together with the remaining format string to the Unicode coercion mechanism and then fiddle the arguments right. Which side-effects are you thinking about here ? Perhaps it would be better to simply raise an exception in case '%s' meets Unicode. -- 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