Skip to main content

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!

Comments

Bob Ippolito said…
isinstance("", basestring)
I've updated the blog posting. Thanks, Bob!