[Python-Dev] Is X a (sequence|mapping)?

Martin v. Loewis martin@mira.cs.tu-berlin.de
Tue, 23 Jan 2001 09:14:32 +0100


> i don't see an easy way to test if something supports one of these
> abstract interfaces in Python.

Why do you want to test for that? If you have an algorithm that only
operates on integer-indexed things, what can you do if the test fails?

So it is always better to just use the object in the algorithm, and
let it break with an exception if somebody passes a bad object.

Regards,
Martin