[Python-Dev] Need a way to test for 8-bit-or-unicode-string (original) (raw)
Aahz Maruch aahz@rahul.net
Sun, 7 Oct 2001 09:00:31 -0700 (PDT)
- 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 ]
[I know we've already reached agreement, but I feel the need to stick my oar in.]
Barry A. Warsaw wrote:
NS> Perhaps we could extend isinstance(). How about NS> isinstance(x, str, unicode) NS> or NS> isinstance(x, (str, unicode)) NS> This is a common problem not limited to string types. I often NS> want to test if something is a tuple or a list for example. That's an interesting idea, but please use the former signature, not the latter.
Ewww, gross, spit spit spit. ;-)
At least with the latter, you can do:
stringtype = (str, unicode)
isinstance(x, stringtype)
Hmmmm... Or can you?
--- Aahz (@pobox.com)
Hugs and backrubs -- I break Rule 6 <*> http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista
We must not let the evil of a few trample the freedoms of the many.
- 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 ]