(self, query)
return sum(bool(query(sub)) for sub in preorder_traversal(self))
Count the number of matching subexpressions.
Count the number of matching subexpressions.
Count the number of matching subexpressions .
def count(self, query):
        """Count the number of matching subexpressions. """
        query = _make_find_query(query)
        return sum(bool(query(sub)) for sub in preorder_traversal(self))
def count ( self , query ) : query = _make_find_query ( query ) return sum ( bool ( query ( sub ) ) for sub in preorder_traversal ( self ) )