<p>I want to write a function that accepts a parameter which can be either a sequence or a single value. The type of value is str, int, etc., but I <strong>don't</strong> want it to be restricted to a hardcoded list. 
In other words, I want to know if the parameter X is a sequence or something I have to convert to a sequence to avoid special-casing later. I could do</p>

<p><code>type(X) in (list, tuple)</code></p>

<p>but there may be other sequence types I'm not aware of, and no common base class.</p>

<p>-N.</p>

<p><strong>Edit</strong>: See my "answer" below for why most of these answers don't help me. Maybe you have something better to suggest.</p>

I think what I would do is check whether the object has certain methods that indicate it is a sequence.  I'm not sure if there is an official definition of what makes a sequence.  The best I can think of is, it must support slicing.  So you could say:
```
```
is_sequence = '__getslice__' in dir(X)
```
```
You might also check for the particular functionality you're going to be using.
As pi pointed out in the comment, one issue is that a string is a sequence, but you probably don't want to treat it as one.  You could add an explicit test that the type is not str.