Difference between unindexable and unsubscriptable
fredrik at pythonware.com
Wed Oct 11 07:33:01 CEST 2006
> What is the difference between "object is unindexable" and "object is
> I would like to test if an object can accept: obj
> >>> from sets import Set
> >>> Set([1,2])
> TypeError: unindexable object
> >>> 3
> TypeError: unsubscriptable object
> It seems like each of these errors can be replaced with a single type error.
the message string is not part of the error type, and may change between
versions. just catch the TypeError and be done with it.
More information about the Python-list