How to determine an object is "scriptable"

Daniel Evers daniel.evers at rwth-aachen.de
Thu Mar 30 09:23:09 EST 2006


Richard Brodie wrote:

> subscriptable: supports an indexing operator, like a list does.

Right. You can check this e.g. with

        hasattr(x, "__getitem__")

because the __getitem__ method is used for indexing.

Daniel



More information about the Python-list mailing list