On Thu, Feb 11, 2010 at 8:44 AM, Vernon Cole <vernondc...@gmail.com> wrote:
> Just a little reminder in all this noise...
>
> The correct thing to do with unicode(u'a unicode string') is MAKE NO CHANGE.
> The correct thing to do with str('an ASCII string') is MAKE NO CHANGE.

Ah, but it's not string literals we're worried about here - it's
objects that implement __str__ or __unicode__.

class Foo(object):
    def __str__(self):
        return 'Foo str'
    def __unicode__(self):
        return 'Foo unicode'

>>> f = Foo()
>>> str(f)
'Foo str'
>>> unicode(f)
'Foo str'

This is bad for Django.

Besides, u'...' and '...' are identical in IronPython anyway - every
string literal is already unicode.

- Jeff
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to