abcd wrote: > Daniel Evers wrote: > >>Right. You can check this e.g. with >> >> hasattr(x, "__getitem__") >> >>because the __getitem__ method is used for indexing. > > Thanks...that is what I was looking for!
Maybe, but it's not a particularly Pythonic way of doing it. Better is probably something like this: try: x[0] x_is_subscriptable = True except TypeError: x_is_subscriptable = False -Peter -- http://mail.python.org/mailman/listinfo/python-list