streaming reductions for Python layer

This is a kludge that works only in a very limited setting.
We should implement scalar expressions and then use those.
py3 fix