<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div>So I want a function or method to operate on one or more strings, but if the convention is usually one, I hate requiring the tuple/list wrapper around a string argument.</div>
</div></blockquote><div><br></div><meta charset="utf-8"><div>It sounds like what you really care about is whether or not you were handed an iterable. If you don't want to say:</div><div><br></div><div> def foo(*strings):</div>
<div> ...</div><div><br></div><div>then you can reliably duck-type like so:</div><div><br></div><div> def foo(strings):</div><div> if not hasattr(strings, '__iter__'):</div><div> strings = (strings,)</div>
<div> ...</div><div><br></div><div>Jesse</div></div>