Oct. 5, 2001
3:20 p.m.
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.
You may be on to something. It certainly saves me inventing a new name! I'll think about it a bit more... --Guido van Rossum (home page: http://www.python.org/~guido/)