How to determine an object is "scriptable"

Daniel Evers daniel.evers at rwth-aachen.de
Thu Mar 30 16:23:09 CEST 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