[I18n-sig] Strawman Proposal: Smart String Test

Paul Prescod paulp@ActiveState.com
Fri, 9 Feb 2001 08:40:28 -0800 (PST)


On Fri, 9 Feb 2001, Toby Dickenson wrote:
> Paul Prescod wrote:
> >Is there a practical problem with this solution?
>
> def isstring(obj):
>   return type(obj) in (StringType, UnicodeType) or isinstance(obj,
> UserString)

Are you saying that there is a problem with isstring? Or proposing a
slightly different formulation?

If the latter: does UserString really behave enough like a string to
"work"? I've never tried it. In particular, does passing a UserString to a
regexp do what you expect? Can you pass a UserString to the open() command
as a filename, etc.?

 Paul Prescod