One thing you might be looking for is collections.Sequence
. This is a bit more specific than what you want, since according to the docs a sequence "supports efficient element access using integer indices"; it's also not specific enough, since nothing explicitly guarantees that getting the same index twice has to return the same value both times. But this would suffice to distinguish lists and tuples from dicts and sets.
However, in general there is no way. In general there cannot be a way, because you can write any iterable you like and there's no requirement that you specify whether it's stable or not. E.g., you can do something like this:
>>> def f():
... if random.random() < 0.5:
... for a in xrange(10):
... yield a
... else:
... stuff = range(10)
... random.shuffle(stuff)
... for a in stuff:
... yield a
>>> list(f())
0: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> list(f())
1: [7, 0, 2, 8, 5, 1, 4, 3, 6, 9]
The fact that iterators can be written without having to declare whether they are stable or not, together with the fact that there isn't a way to tell by iterating over something whether it will iterate the same way later, means that there can be no way to tell if a given iterator is stable or not.
I would advise you to simply document that your function needs stability of iteration order. You can also explicitly check for builtin types that you know might not be stable, and raise an error on those. But there is no way to check in general for the stability of an arbitrary user-defined iterator's stability.