docs: def terms(self):
          """Iterator over the terms of the sum
  
          Yield from the (possibly) infinite list of terms of the indexed sum, if
          the sum was written out explicitly. Each yielded term in an instance of
          :class:`.Expression`
          """
          from qnet.algebra.core.scalar_algebra import ScalarValue
          for mapping in yield_from_ranges(self.ranges):
              term = self.term.substitute(mapping)
              if isinstance(term, ScalarValue._val_types):
                  term = ScalarValue.create(term)
              assert isinstance(term, Expression)
              yield term