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
True

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:

   isinstance(x, basestring)

which will work whether x='asdf' or x=u'asdf'.

Best,
- Joe

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to