[Python-Dev] Need a way to test for 8-bit-or-unicode-string
Greg Ward
gward@python.net
Fri, 5 Oct 2001 12:28:49 -0400
On 05 October 2001, Guido van Rossum said:
> - Create a new service function, IsString(x) or isString(x) or
> isstring(x), that's a shortcut for "isinstance(x, str) or
> isinstance(x, unicode)". The question them becomes where to put
> this: as a builtin, in types.py, or somewhere else...
I've thought Python should have this for a long time. But Marc-Andre's
point pretty much shoots it down, unless you make isstring(x) sugar for
isinstance(x, (str, unicode))
Hmmm. It's a very small dose of sugar, but I like it all the same.
> [...] (BTW this shows to me again that the method
> signature is right and the function signature is wrong. But even my
> time machine isn't powerful enough to fix this.) (Hm, it could be
> saved by making string.join() accept the arguments in either order.
> Gross. :-)
Note that a certain infamous April Fool's post from a few years back
said that that was what Python 1.6 would do. I wasn't serious,
either. ;-)
Greg
--
Greg Ward - just another /P(erl|ython)/ hacker gward@python.net
http://starship.python.net/~gward/
LILO boot: linux init=/usr/bin/emacs