def __iter__(self):
        '''Create destructive sorted iterator of priorityDictionary.'''
        def iterfn():
            while len(self) > 0:
                x = self.smallest()
                yield x
                del self[x]
        return iterfn()
Create destructive sorted iterator of priorityDictionary.
recipes/Python/117228_Priority_dictionary/recipe-117228.py