[I18n-sig] Re: Strawman Proposal: Smart String Test

Paul Prescod paulp@ActiveState.com
Sun, 11 Feb 2001 14:24:21 -0800


Fredrik Lundh wrote:
> 
> ...
>
>     isinstance(foo, type(""))
> 
> I think it's okay only the latter works, for now (which can
> be solved by a simple and stupid hack, while waiting for a
> real type hierarchy...)

I have two concerns. First I'm not thrilled with having isinstance have
specific knowledge of string types. People will ask us: "How do I set up
a type hierarchy like the string hierarchy?" And they can't...an
isstring() function is clear about the fact that it is special.

My second concern is that this might break a little bit of code. For
instance something like this:

if issinstance(foo, type("")): print foo
elif issinstance(foo, type(u"")): print foo.encode("UTF-8")

 Paul Prescod