[Python-Dev] Need a way to test for 8-bit-or-unicode-string (original) (raw)
Neil Schemenauer nas@python.ca
Fri, 5 Oct 2001 08:11:36 -0700
- Previous message: [Python-Dev] Need a way to test for 8-bit-or-unicode-string
- Next message: [Python-Dev] Need a way to test for 8-bit-or-unicode-string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote:
if isinstance(x, str) or isinstance(x, unicode): is apparently too much typing.
Perhaps we could extend isinstance(). How about
isinstance(x, str, unicode)
or
isinstance(x, (str, unicode))
This is a common problem not limited to string types. I often want to test if something is a tuple or a list for example.
Neil
- Previous message: [Python-Dev] Need a way to test for 8-bit-or-unicode-string
- Next message: [Python-Dev] Need a way to test for 8-bit-or-unicode-string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]