get_item

ObjectIndex.get_item(arg)

Retrieves the exact index location of the given argument.

Parameters

argobject

The key to retrieve the index for.

Returns

int

The index of the key.

Raises

KeyError

If the key is not found or invalid.

Examples

>>> idx = ObjectIndex(['a', 'b', 'c'])
>>> idx.get_item('b')
1
>>> idx.get_item('d')
KeyError: 'd is not a member of the index.'