(self,func)
return count
prune from left until func(self[x]) returns false
prune from left until func(self[x]) returns false
prune from left until func ( self [ x ] ) returns false
def prune(self,func):
        '''prune from left until func(self[x]) returns false'''
        count = 0
        cur = self.first
        while cur and func(cur.me[1]):
            count = count + 1
            cur2 = cur.next
            if cur2 is not None:
                cur2.prev = None
            del self.d[cur.me[0]]
            cur = cur2
        self.first = cur
        if cur is None or cur.next is None:
            self.last = cur
        return count
def prune ( self , func ) : count = 0 cur = self . first while cur and func ( cur . me [ 1 ] ) : count = count + 1 cur2 = cur . next if cur2 is not None : cur2 . prev = None del self . d [ cur . me [ 0 ] ] cur = cur2 self . first = cur if cur is None or cur . next is None : self . last = cur return count