John J Lee <jjl at pobox.com> wrote: > The note (4) says that the result will be unicode, but it doesn't say how, > in this case, that comes about. This case is confusing because the docs > claim string formatting with %s "converts ... using str()", and yet > str(a()) returns a bytestring. Does it *really* use str, or just __str__? > Surely the latter? (given the observed behaviour, and not reading the C > source) It uses __str__ and confirms that the returned object is a 'str' or 'unicode'. The docs are not precise but they were not for 2.4 either. Note the following case: '%s' % u'Hello!' The operand is not forced to be a str. Neil
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