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

4.25. SkipList.__iter__()

The special .__iter__() method returns an iterator that walks the entire skip list in order. The logic is trivial: we pass the successor of the level-0 list head to the _SkipListIterator constructor. See Section 4.4, “The _SkipListIterator class”.

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

    def __iter__ ( self ):
        """Iterator for the entire list"""
        return _SkipListIterator ( self.__heads.links[0] )