[I18n-sig] Strawman Proposal: Smart String Test

Toby Dickenson tdickenson@geminidataloggers.com
Mon, 12 Feb 2001 08:01:58 +0000

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

>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?

At the moment we dont have a tight definition of the 'string
interface'. While I think we can agree that old code which uses
type(x)=3D=3DStringType is probably wrong, Im not sure we can agree what
that code should be using without examining that code.

Note that several similar interface-testing functions are very rarely
used (operator.isNumberType, operator.isMappingType), and Python
doesnt have functions for other more popular interfaces (no
isFileType, for example).=20

Toby Dickenson