How do I distinguish a string from a sequence?

Tim Peters tim.one at home.com
Fri Sep 28 20:32:30 EDT 2001


[Tim]
> Stick in tests to cover that too, and you'll soon appreciate
> why I settled for
>
>     type(args) in types.StringTypes
>
> at the start <wink>.
>

[David Bolen]
> Although it looks like you have to be using 2.2 for that to work,
> right?

I don't know, but that info is available to anyone by perusing the CVS logs.

> A quick check on my system of 1.5.2 through 2.1.1 doesn't have
> a StringTypes list in the types module (although it could of course
> just be defined locally if not present).

Certainly no version of Python before Unicode was introduced would have it.





More information about the Python-list mailing list