Monday, February 26, 2007

PyCon: Python, Unicode, and I18N

Instead of checking for str and unicode separately, use:
 >>> from types import StringTypes
>>> isinstance("", StringTypes)
True
Otherwise, this was an extremely basic talk.

Update: Use:
 >>> isinstance("", basestring)
True
Thanks, Bob Ippolito!

2 comments:

Bob Ippolito said...

isinstance("", basestring)

Shannon -jj Behrens said...

I've updated the blog posting. Thanks, Bob!