def calculate_children(evaluator, children):
 iterator = iter(children)
 types = evaluator.eval_element(next(iterator))
 for operator in iterator:
  right = next(iterator)
  if tree.is_node(operator, 'comp_op'):
   operator = ' '.join((str(c.value) for c in operator.children))
  if (operator in ('and', 'or')):
   left_bools = set([left.py__bool__() for left in types])
   if (left_bools == set([True])):
    if (operator == 'and'):
     types = evaluator.eval_element(right)
   elif (left_bools == set([False])):
    if (operator != 'and'):
     types = evaluator.eval_element(right)
  else:
   types = calculate(evaluator, types, operator, evaluator.eval_element(right))
 debug.dbg('calculate_children types %s', types)
 return types

def calculate_children ( evaluator , children ) : iterator = iter ( children ) types = evaluator . eval_element ( next ( iterator ) ) for operator in iterator : right = next ( iterator ) if tree . is_node ( operator , 'comp_op' ) : operator = ' ' . join ( ( str ( c . value ) for c in operator . children ) ) if ( operator in ( 'and' , 'or' ) ) : left_bools = set ( [ left . py__bool__ ( ) for left in types ] ) if ( left_bools == set ( [ True ] ) ) : if ( operator == 'and' ) : types = evaluator . eval_element ( right ) elif ( left_bools == set ( [ False ] ) ) : if ( operator != 'and' ) : types = evaluator . eval_element ( right ) else : types = calculate ( evaluator , types , operator , evaluator . eval_element ( right ) ) debug . dbg ( 'calculate_children types %s' , types ) return types
calculate a list of children with operators .