[Zope-Coders] unicode question

Steve Alexander steve@cat-box.net
Fri, 05 Oct 2001 15:03:49 +0100


 
>> So, should I add two if clauses?
>>
>>   if isinstance(names, types.StringType):
>>       names=(names,)
>>   if isinstance(names, types.UnicodeType):
>>       names=(names,)
> 
> Or obviously an "or" instead.


Or even this:

   if type(names) in (types.StringType, types.UnicodeType):
       names=(names,)


Although, I'm sure using isinstance is better than comparing types.


-- 
Steve Alexander