Eric V. Smith added the comment:

I suggest using whatever language explains what "u'%s' %obj" does. It's the 
same behavior.

>From the SO question, given:

class A(object):
    def __str__(self):
        return 'as str'

    def __unicode__(self):
        return u'as unicode'

Then:

>>> '%s' % A()
'as str'
>>> u'%s' % A()
u'as unicode'

and:

>>> '{!s}'.format(A())
'as str'
>>> u'{!s}'.format(A())
u'as unicode'

----------
nosy: +eric.smith

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to