Next / Previous / Contents / TCC Help System / NM Tech homepage

4.28. SkipList.__getitem__()

This special method name is called when a user retrieves an element from a skiplist using the syntax “s[k]”. Note that a KeyError exception will be raised if no child objects have a matching key.

pyskip.py
# - - -   S k i p L i s t . _ _ g e t i t e m _ _   - - -

    def __getitem__ ( self, key ):
        """Get the first or only item with a given key."""
        return self.match ( key )