def push(self, element, value):
        """Push an ``element`` into the datastrucutre together with its value
           and only save it if it currently is one of the top n elements.

           Drop elements if necessary.
        """
        insert_pos = 0
        for index, el in enumerate(self.tops):
            if not self.find_min and el[1] >= value:
                insert_pos = index+1
            elif self.find_min and el[1] <= value:
                insert_pos = index+1
        self.tops.insert(insert_pos, [element, value])
        self.tops = self.tops[:self.n]
def push ( self , element , value ) : insert_pos = 0 for index , el in enumerate ( self . tops ) : if not self . find_min and el [ 1 ] >= value : insert_pos = index + 1 elif self . find_min and el [ 1 ] <= value : insert_pos = index + 1 self . tops . insert ( insert_pos , [ element , value ] ) self . tops = self . tops [ : self . n ]
Push an ``element`` into the datastrucutre together with its value
           and only save it if it currently is one of the top n elements.

           Drop elements if necessary.