Re: Single string vs list of strings

2008-10-31 Thread greg
Grant Edwards wrote: Checking to see if something is a sequence of strings is a bit trickier, since a string is actually a sequence of strings. For that reason I'd just check whether it's a string, and if it's anything else, assume it's a sequence of strings. You'll find out soon enough if it

Re: Single string vs list of strings

2008-10-30 Thread Joe Strout
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,

Re: Single string vs list of strings

2008-10-30 Thread Grant Edwards
On 2008-10-30, Scott Sharkey <[EMAIL PROTECTED]> wrote: > I have a need to determine whether a passed variable is a single string, > or a list of strings. What is the most pythonic way to do this? >>> type('asdf') is list False >>> type(['asdf','qwer']) is list True The question you might want

Single string vs list of strings

2008-10-30 Thread Scott Sharkey
Hi All, I have a need to determine whether a passed variable is a single string, or a list of strings. What is the most pythonic way to do this? Thanks. -Scott -- http://mail.python.org/mailman/listinfo/python-list