John J Lee wrote: > Is this a bug? I don't believe so - the string formatting documentation states that the result will be unicode if either the format string is unicode or any of the objects passed to a %s format code is unicode.
That latter part has just been extended to include any object that returns Unicode from __str__, instead of being restricted to actual Unicode instances. Note that the following behaves the same way regardless of whether you use 2.4 or 2.5: "%s" % 'hi' "%s" % u'hi' And once the result has been promoted to unicode, __unicode__ is used directly: >>> print repr("%s%s" % (a(), a())) __str__ accessing <__main__.a object at 0x00AF66F0>.__unicode__ __str__ accessing <__main__.a object at 0x00AF6390>.__unicode__ __str__ u'hihi' Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com