[Python-Dev] Toby Dickenson's Unicode experience

Guido van Rossum guido@beopen.com
Fri, 07 Jul 2000 07:29:27 -0500


He's got a point...

Maybe add ustr(x) with the semantics below?

--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)

------- Forwarded Message

Date:    Fri, 07 Jul 2000 10:53:39 +0100
From:    Toby Dickenson <mbel44@dial.pipex.net>
To:      I18n-sig@python.org
Subject: [I18n-sig] Unicode experience

I'm just nearing the end of getting Zope to play well with unicode
data. Most of the changes involved replacing a call to str, in
situations where either a unicode or narrow string would be
acceptable.

My best alternative is:

def convert_to_something_stringlike(x):
    if type(x)==type(u''):
        return x
    else:
        return str(x)

This seems like a fundamental operation - would it be worth having
something similar in the standard library?



Toby Dickenson
tdickenson@geminidataloggers.com

_______________________________________________
I18n-sig mailing list
I18n-sig@python.org
http://www.python.org/mailman/listinfo/i18n-sig

------- End of Forwarded Message