Single string vs list of strings
joe at strout.net
Thu Oct 30 16:10:18 CET 2008
On Oct 30, 2008, at 8:55 AM, Grant Edwards wrote:
> The question you might want to asked is whether the parameter
> is a single string or a sequence of strings. That way your
> code will also work with an iterator that returns strings.
>>>> type('asdf') is str
I agree with the general approach, but this test will fail for Unicode
strings, and so is probably bad mojo moving forward. Instead I suggest:
which will work whether x='asdf' or x=u'asdf'.
More information about the Python-list